Results 1 to 4 of 4

Thread: Soap calls for setting relationships Accounts - SecurityGroups

  1. #1
    maggix is offline Member
    Join Date
    Sep 2008
    Posts
    7

    Default Soap calls for setting relationships Accounts - SecurityGroups

    Hello, I need your help to solve a problem I'm having lately, about using Soap and the get_relationships and set_relationships calls.

    The modules I need to get/write data from/to are Users, Accounts and SecurityGroups (an awesome module available in SugarForge).

    SecurityGroups, in case you don't know sets many-to-many relationships between Users and Groups and between Accounts and Groups (to make it short).

    Using Sugar SOAP, I can retrieve the Group (or more than one) a user is in, with this code:

    PHP Code:
    $get_params2 = array('session'=>$session
                         
    'module_name'=>'Users',
                         
    'module_id'=>'INSERT_USER_ID_HERE',
                         
    'related_module'=>'SecurityGroups',
                         
    'related_module_query'=>'',
                         
    'deleted'=>'false',
                         );
    $result2 $soapclient->call('get_relationships'$get_params2); 
    I can also check which groups are related to an account, with this :

    PHP Code:
    $get_account_params = array('session'=>$session
                         
    'module_name'=>'Accounts',
                         
    'module_id'=>'ACCOUNT_ID_HERE',
                         
    'related_module'=>'SecurityGroups',
                         
    'related_module_query'=>'',
                         
    'deleted'=>'false',
                         );
        
    $account_result $soapclient->call('get_relationships'$get_account_params); 
    However, there is no way I can set the relationship between an Account and a Group. Those relationships are managed through a table that contains the fields ID (of the entry) and the IDs of the account and the group, respectively.

    I tried with the following code, without success:

    PHP Code:
    $set_rel_params = array('session' => $session,
                              
    'set_relationship_value' => array(
                                    
    'module1'=> 'Accounts',
                                    
    'module1_id'=> '10160611-da35-6633-28b8-469e2b789c64',
                                    
    'module2' => 'SecurityGroups',
                                    
    'module2_id'=> '104123ab-7ae3-df7a-d45e-465bd921739e'));
                                
    $set_rel_result$soapclient->call('set_relationships',$set_rel_params); 

    This does, in fact, create a new GROUP (!) and not a relation, in the table that contains the list of groups in SecurityGroup Module.


    I tried all the combination of the 2 modules, I also searched the forums for more info, I edited the SoapSugarUsers.php file as suggested in many threads but I could not figure how to do what I need to do (setting the relationship between an Account and a Group) using Soap.

    Any help would be appreciated.

    Thank you in advance

    Regards

    Giovanni

  2. #2
    DigiCRM is offline Senior Member
    Join Date
    Sep 2008
    Posts
    84

    Default Re: Soap calls for setting relationships Accounts - SecurityGroups

    $get_relationships_result= $client->call('get_relationships',array("session"=>$sessio n_id,"module_name"=>"SecurityGroups","module_id"=> $id,"related_module"=>"Accounts","related_module_q uery"=>"","deleted"=>0));
    $id is SecurityGroups id.


    try this code in the same way.if any prob send reply

  3. #3
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Soap calls for setting relationships Accounts - SecurityGroups

    Giovanni,

    Have you had any luck in finding a way to add the relationship through SOAP?

  4. #4
    ryanschulz is offline Member
    Join Date
    Aug 2005
    Posts
    8

    Default Re: Soap calls for setting relationships Accounts - SecurityGroups

    Guys-

    I'm having the exact same issue - unable to associate a security group to a user. Has anyone figured out how to do this via Soap API?

    Please advise.

    Thanks!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 2009-02-05, 07:20 PM
  2. SOAP - setting email for contact via soap
    By darcy.rippon in forum Developer Help
    Replies: 3
    Last Post: 2008-09-22, 08:13 PM
  3. Replies: 2
    Last Post: 2008-07-08, 05:28 AM
  4. Setting relationships
    By scottnursten in forum Developer Help
    Replies: 0
    Last Post: 2006-08-31, 01:47 PM
  5. soap interface relationships
    By rusty in forum Developer Help
    Replies: 3
    Last Post: 2005-09-28, 03:21 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
  •