Results 1 to 10 of 10

Thread: SOAP, Accounts Module

  1. #1
    xlep is offline Sugar Community Member
    Join Date
    Jan 2012
    Posts
    18

    Default SOAP, Accounts Module

    I'm having some trouble with my PHP/SOAP form that's supposed to enter Data into sugarcrm.

    We used it to create Leads until now and it worked flawless. Since we do not want to use the Lead module anymore I tried to edit the form so SOAP creates a new Contact and a new Account instead.

    Creating a contact works fine with a few modifications but SugarCRM refuses to write into Accounts via my SOAP calls. I'm no expert but I can't find anything on the subject. Do you guys have any ideas?

    It's hard to post code since I can't Pinpoint any crucial passages. In essence it comes down to this:

    Code:
    $sugar->set_entry("Contacts", $sugar->fromAssoc($data_contact));
    this works

    Code:
    $sugar->set_entry("Accounts", $sugar->fromAssoc($data_account));
    this doesn't

    Switching the arrays has no effect and all other default-modules work as well (Leads, Opportunities, etc.)

    here's what fromAssoc does
    Code:
    function fromAssoc($array)
    {
        $multi = array();
      
        while(list($name, $value) = each($array))
        {
            $multi[] = array("name" => $name, "value" => $value);
        }
          
        return $multi;
    }
    Are there any known problems or bugs regarding this?
    Also I was thinking about working around the problem by writing directly into the database is there any way to do this (I know the basics of writing into the DB, but I have no clue what I'd have to pick for the "id" column)?
    Last edited by xlep; 2012-01-18 at 04:24 PM. Reason: adjusted the layout of the 3rd code segment

  2. #2
    jmertic is offline Sugar Community Manager
    Join Date
    Dec 2007
    Posts
    2,224

    Default Re: SOAP, Accounts Module

    Quote Originally Posted by xlep View Post
    I'm having some trouble with my PHP/SOAP form that's supposed to enter Data into sugarcrm.

    We used it to create Leads until now and it worked flawless. Since we do not want to use the Lead module anymore I tried to edit the form so SOAP creates a new Contact and a new Account instead.

    Creating a contact works fine with a few modifications but SugarCRM refuses to write into Accounts via my SOAP calls. I'm no expert but I can't find anything on the subject. Do you guys have any ideas?

    It's hard to post code since I can't Pinpoint any crucial passages. In essence it comes down to this:

    Code:
    $sugar->set_entry("Contacts", $sugar->fromAssoc($data_contact));
    this works

    Code:
    $sugar->set_entry("Accounts", $sugar->fromAssoc($data_account));
    this doesn't

    Switching the arrays has no effect and all other default-modules work as well (Leads, Opportunities, etc.)

    here's what fromAssoc does
    Code:
    function fromAssoc($array)
    {
        $multi = array();
      
        while(list($name, $value) = each($array))
        {
            $multi[] = array("name" => $name, "value" => $value);
        }
          
        return $multi;
    }
    Are there any known problems or bugs regarding this?
    Also I was thinking about working around the problem by writing directly into the database is there any way to do this (I know the basics of writing into the DB, but I have no clue what I'd have to pick for the "id" column)?
    Any sorts of errors coming back from the web service?
    John Mertic
    Sugar Community Manager

  3. #3
    xlep is offline Sugar Community Member
    Join Date
    Jan 2012
    Posts
    18

    Default Re: SOAP, Accounts Module

    forgot to mention that. No there's no errors in the sugarcrm.log, or in the apache log files. Also tried it with a clean install of 6.3.1 and 6.1.7 on my local machine (with xampp) in the mean time, no change though...

  4. #4
    gauts is offline Sugar Community Member
    Join Date
    Aug 2007
    Location
    France
    Posts
    27

    Default Re: SOAP, Accounts Module

    Hi,

    it is possible to write directly into the database.

    In order to get a valid record id, you'll need to use the create_guid() function located in include/utils.php

    But I do think this is not the best solution and solving your soap problem would be better.

    Did you make sure to have all required fields in your data ?

    Did you add any custom fields in the accounts module ?
    Gauthier GENEAU
    CIGO SAS
    10 grand rue 68280 Logelheim (France)
    http://www.cigo-developpement.fr

  5. #5
    xlep is offline Sugar Community Member
    Join Date
    Jan 2012
    Posts
    18

    Default Re: SOAP, Accounts Module

    Quote Originally Posted by gauts View Post
    Hi,

    it is possible to write directly into the database.

    In order to get a valid record id, you'll need to use the create_guid() function located in include/utils.php

    But I do think this is not the best solution and solving your soap problem would be better.

    Did you make sure to have all required fields in your data ?

    Did you add any custom fields in the accounts module ?
    Thanks for the info. Yeah I'd prefer to use the SOAP methods, but at least I know thre's a workaround now

    Yeah, we've added custom fields in our sugarcrm Accounts module, but I've also tried two clean installs (6.3.1 and 6.1.7 and it didn't work either. I also tried to create a new Entry in Accounts and Contacts with the same data (only the assigned user) and it only works for Contacts.

  6. #6
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: SOAP, Accounts Module

    An additional comment to add on to what's already been asked/suggested, historically, I recall that the SOAP API doesn't like null values in the 'value' portion of the name/value array. Check the values that you are passing to verify that none of them are null.
    Regards,

    Angel Magaņa
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  7. #7
    xlep is offline Sugar Community Member
    Join Date
    Jan 2012
    Posts
    18

    Default Re: SOAP, Accounts Module

    I'm replying a little bit slow due to the spam-control for new users

    Quote Originally Posted by Angel View Post
    An additional comment to add on to what's already been asked/suggested, historically, I recall that the SOAP API doesn't like null values in the 'value' portion of the name/value array. Check the values that you are passing to verify that none of them are null.
    This shouldn't be a problem since I already tried creating one Accounts-entry with nothing but "required fields" and one with "assigned user id" as the only data passed on to the SOAP method (from a field-database point of view).

    I'll try a workaround with direct SQL-Queries but it's not a nice, clean solution so I'm still hoping to find a better way in the long run

  8. #8
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: SOAP, Accounts Module

    I am not sure that lines up with what I meant...

    I meant, say you do something like this in your name/value array:

    name =>'name', value =>'acme',
    name => null, value => null

    I think what you are saying is that you did something like this:

    name =>'name', value =>'acme',
    name => 'annual_revenue', value => null
    Regards,

    Angel Magaņa
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  9. #9
    xlep is offline Sugar Community Member
    Join Date
    Jan 2012
    Posts
    18

    Default Re: SOAP, Accounts Module

    Quote Originally Posted by Angel View Post
    I am not sure that lines up with what I meant...

    I meant, say you do something like this in your name/value array:

    name =>'name', value =>'acme',
    name => null, value => null

    I think what you are saying is that you did something like this:

    name =>'name', value =>'acme',
    name => 'annual_revenue', value => null
    ah ok, what I meant to say was:
    I tested it with only passing name => 'asssigned_user_id', value => '1' and it while it worked creating a Lead or Contact it did not work for Accounts, so I figure that the problem must lie somewhere else

  10. #10
    jmertic is offline Sugar Community Manager
    Join Date
    Dec 2007
    Posts
    2,224

    Default Re: SOAP, Accounts Module

    Quote Originally Posted by xlep View Post
    forgot to mention that. No there's no errors in the sugarcrm.log, or in the apache log files. Also tried it with a clean install of 6.3.1 and 6.1.7 on my local machine (with xampp) in the mean time, no change though...
    How about in the response itself. Sometimes there are PHP errors that aren't caught by the normal logging that mess things up.
    John Mertic
    Sugar Community Manager

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Getting Accounts List using SOAP and VB.net
    By manvirrr in forum Developer Tutorials
    Replies: 0
    Last Post: 2011-10-19, 02:40 PM
  2. Soap连接Accounts module出问题
    By frankhuang in forum Chinese
    Replies: 2
    Last Post: 2011-04-14, 09:07 AM
  3. updating accounts via SOAP
    By uamoreno in forum Developer Help
    Replies: 1
    Last Post: 2008-10-21, 12:35 AM
  4. Replies: 2
    Last Post: 2008-08-18, 02:57 AM
  5. Replies: 4
    Last Post: 2008-03-12, 12:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •