Results 1 to 4 of 4

Thread: SOAP set_relationship fails relating Opportunities to Accounts

  1. #1
    markriggins is offline Sugar Community Member
    Join Date
    Jan 2011
    Posts
    22

    Default SOAP set_relationship fails relating Opportunities to Accounts

    Hi,

    SugarCRM 6.1.1

    I'm trying to relate an Account to an Opportunity, using the 'accounts_opportunities' link.


    $response = $this->client->set_relationship($this->session_id,
    'Accounts',
    $a_valid_account_id,
    'accounts_opportunities',
    array( $a_valid_opportunity_id));

    I know that the id's I'm passing are good.

    I traced this in the debugger and found that the Accounts bean had no field_def entry for 'accounts_opportunities' so it fails without ever looking at the id of the opportunity that I sent.

    Am I doing something wrong? I'm using the same code style for several other modules
    and it always works.

    Is this fixed in 6.2?

    Mark

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: SOAP set_relationship fails relating Opportunities to Accounts

    The correct syntax is:

    PHP Code:
    $response $this->client->set_relationship($this->session_id
    'Accounts',
    $a_valid_account_id
    'Opportunities'
    array( 
    $a_valid_opportunity_id)); 
    Regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  3. #3
    markriggins is offline Sugar Community Member
    Join Date
    Jan 2011
    Posts
    22

    Default Re: SOAP set_relationship fails relating Opportunities to Accounts

    That didn't fix it. I got this response:
    (("CLASSNAME" . "stdClass") ("created" . 0) ("failed" . 1) ("deleted" . 0))



    The docs say:


    set_relationship(session, module_name, module_id, link_field_name, related_ids)

    When I call, get_module_fields('Accounts') it tells me that 'accounts_opportunities' is the link field.

    Mark

  4. #4
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: SOAP set_relationship fails relating Opportunities to Accounts

    The document is wrong.
    I browsed the soap code to provide you the answer, exactaly as soap api expect to receive the parameters.
    You can browse soap/SoapSugarUsers.php
    Functions "set_relationship" and "handle_set_relationship".

    Regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 2010-09-16, 01:13 PM
  2. need SOAP set_relationship help
    By darcy.rippon in forum Developer Help
    Replies: 5
    Last Post: 2009-02-02, 07:24 PM
  3. SOAP Opportunities to Accounts issue
    By iastor in forum Developer Help
    Replies: 3
    Last Post: 2008-06-18, 02:02 AM
  4. nusoap set_relationship for Contacts and Opportunities
    By sittcomm in forum Developer Help
    Replies: 2
    Last Post: 2008-04-12, 12:16 PM
  5. Relating Accounts to Contacts using SOAP API
    By datla27 in forum Developer Help
    Replies: 3
    Last Post: 2007-07-05, 06:36 AM

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
  •