Results 1 to 6 of 6

Thread: soap relationships

  1. #1
    eitrix's Avatar
    eitrix is offline Sugar Community Member
    Join Date
    Aug 2010
    Location
    Serbia
    Posts
    396

    Default soap relationships

    Just to share with everyone, here is a solution that worked.

    PHP Code:
    $rl = array(

    // session id from login
        
    'session' => $session_id,
        
    'set_relationship_value' => array(

    // put here the module that shows subpanel in 1:n relationships, in this case Calls is subpanel in opportunity
        
    'module1' => 'Opportunities',
        
    'module1_id' => $resultOpId['id'],

    // put here the other module you are relating to
        
    'module2' => 'Calls',
        
    'module2_id' => $resultCaId['id'],
        
        )
    );
    // call to set relationship
    $resultRel $client->call('set_relationship',$rl);
    echo 
    '<br />';
    // print test results
    print_r($resultRel); 
    My working edition is sugar 6 ent and i have included in file nusoap.php from sugarcrm include/nusoap/nusoap.php
    CRM Software Engineer
    Eontek - www.eontek.rs

  2. #2
    anat is offline Member
    Join Date
    Aug 2010
    Location
    Adelaide, South Australia, Australia
    Posts
    11

    Default Re: soap relationships

    Note that your unable to delete a relationship unless you change to the v2 of the SugarSOAP api.

    Check out http://crm.yourdomain.com/service/v2/soap.php

    You'll find that there's less functions but most of the ones that are there suddenly need a link_name_to_fields_array or name_value_list entries which will mean you'll have to change your code.
    So far I've been setting the 'link_name_to_fields_array' to null as I can't find an explanation of what they do. I can't find one ANYWHERE. Not via Google, not via these forums, not by reading the docs, not even by reading the source code. I just don't understand what they are for


    The closest I could find was the basic source code documentation at https://code.sugarcrm.com/viewvc/pub...?view=annotate

    55 * @param Array $link_name_to_fields_array -- A list of link_names and for each link_name, what fields value to be returned. For ex.'link_name_to_fields_array' => array(array('name' => 'email_addresses', 'value' => array('id', 'email_address', 'opt_out', 'primary_address')))
    56 * @return Array
    57 * 'entry_list' -- Array - The records name value pair for the simple data types excluding link field data.
    58 * 'relationship_list' -- Array - The records link field data. The example is if asked about accounts email address then return data would look like Array ( [0] => Array ( [name] => email_addresses [records] => Array ( [0] => Array ( [0] => Array ( [name] => id [value] => 3fb16797-8d90-0a94-ac12-490b63a6be67 ) [1] => Array ( [name] => email_address [value] => hr.kid.qa@example.com ) [2] => Array ( [name] => opt_out [value] => 0 ) [3] => Array ( [name] => primary_address [value] => 1 ) ) [1] => Array ( [0] => Array ( [name] => id [value] => 403f8da1-214b-6a88-9cef-490b63d43566 ) [1] => Array ( [name] => email_address [value] => kid.hr@example.name ) [2] => Array ( [name] => opt_out [value] => 0 ) [3] => Array ( [name] => primary_address [value] => 0 ) ) ) ) )
    Michael Kubler | Technology Officer

    Australian Network for Art and Technology [ANAT]
    e: anat@anat.org.au | ph: +61 8 8231 9037

    www.anat.org.au | www.filter.org.au | www.synapse.net.au
    Twitter: __ANAT | Facebook: http://bit.ly/bF9fXl

    The Australian Network for Art and Technology (ANAT) is supported by the Visual Arts and Craft Strategy, an initiative of the Australian, State and Territory Governments; the Australian Government through the Australia Council, its arts funding and advisory body, and the South Australian Government through Arts SA.

  3. #3
    craigotis is offline Member
    Join Date
    Sep 2010
    Posts
    7

    Default Re: soap relationships

    Quote Originally Posted by anat View Post
    Note that your unable to delete a relationship unless you change to the v2 of the SugarSOAP api.

    Check out http://crm.yourdomain.com/service/v2/soap.php

    You'll find that there's less functions but most of the ones that are there suddenly need a link_name_to_fields_array or name_value_list entries which will mean you'll have to change your code.
    So far I've been setting the 'link_name_to_fields_array' to null as I can't find an explanation of what they do. I can't find one ANYWHERE. Not via Google, not via these forums, not by reading the docs, not even by reading the source code. I just don't understand what they are for


    The closest I could find was the basic source code documentation at https://code.sugarcrm.com/viewvc/pub...?view=annotate

    55 * @param Array $link_name_to_fields_array -- A list of link_names and for each link_name, what fields value to be returned. For ex.'link_name_to_fields_array' => array(array('name' => 'email_addresses', 'value' => array('id', 'email_address', 'opt_out', 'primary_address')))
    56 * @return Array
    57 * 'entry_list' -- Array - The records name value pair for the simple data types excluding link field data.
    58 * 'relationship_list' -- Array - The records link field data. The example is if asked about accounts email address then return data would look like Array ( [0] => Array ( [name] => email_addresses [records] => Array ( [0] => Array ( [0] => Array ( [name] => id [value] => 3fb16797-8d90-0a94-ac12-490b63a6be67 ) [1] => Array ( [name] => email_address [value] => hr.kid.qa@example.com ) [2] => Array ( [name] => opt_out [value] => 0 ) [3] => Array ( [name] => primary_address [value] => 1 ) ) [1] => Array ( [0] => Array ( [name] => id [value] => 403f8da1-214b-6a88-9cef-490b63d43566 ) [1] => Array ( [name] => email_address [value] => kid.hr@example.name ) [2] => Array ( [name] => opt_out [value] => 0 ) [3] => Array ( [name] => primary_address [value] => 0 ) ) ) ) )
    Have you made any progress as to the link_name_to_fields_array parameter? We recently upgraded to v2 of the SOAP API, and we're updating our client-side calls to match the new call arguments. We have no idea what the link_name parameter means, or what to set it as. Setting it to null is causing errors, and none of our queries are functioning.

  4. #4
    katjapflaeging is offline Junior Member
    Join Date
    Aug 2010
    Posts
    2

    Smile Re: soap relationships

    Just check out the example in the comment for get_entry() in class SugarWebServiceImpl, service/core/SugarWebServiceImpl.php

  5. #5
    anat is offline Member
    Join Date
    Aug 2010
    Location
    Adelaide, South Australia, Australia
    Posts
    11

    Default Re: soap relationships

    I've written a PHP script to output a list of available modules and their available link field names, but will have to check some of the other code that it relies on and try to make it a little more portable and public friendly before releasing it. The core code uses the get_available_modules and then get_module_fields for each module.

    I was also working on a unit function test to see what you can and can't do.
    At the moment I've got no issues with creating a new lead, updating a contact, or searching via email, but I'm having a hell of an issue setting relationships. Even worse is when trying to remove a relationship (as is required to subscribe a previously unsubscribed contact from a newsletter/email campaign).

    These can help :
    http://developers.sugarcrm.com/wordp...-web-services/

    http://developers.sugarcrm.com/wordp...-web-services/
    Michael Kubler | Technology Officer

    Australian Network for Art and Technology [ANAT]
    e: anat@anat.org.au | ph: +61 8 8231 9037

    www.anat.org.au | www.filter.org.au | www.synapse.net.au
    Twitter: __ANAT | Facebook: http://bit.ly/bF9fXl

    The Australian Network for Art and Technology (ANAT) is supported by the Visual Arts and Craft Strategy, an initiative of the Australian, State and Territory Governments; the Australian Government through the Australia Council, its arts funding and advisory body, and the South Australian Government through Arts SA.

  6. #6
    anat is offline Member
    Join Date
    Aug 2010
    Location
    Adelaide, South Australia, Australia
    Posts
    11

    Default Re: soap relationships

    Hi,
    OK. I've uploaded the module, fields and link_fields lister script.
    You can get it from http://w00t.anat.org.au/2010/11/24/s...fields-lister/
    Let me know if you have any issues, or if you find this useful (I have a couple of other scripts I'm working on such as using the Wordpress CFormsII plugin with SugarCRM, and also trying to make it easy to add new leads/contacts, etc..
    If you are interested then let me know and I'll try and add the others online once I've made them ready for the public.

    Cheers!
    Michael Kubler | Technology Officer

    Australian Network for Art and Technology [ANAT]
    e: anat@anat.org.au | ph: +61 8 8231 9037

    www.anat.org.au | www.filter.org.au | www.synapse.net.au
    Twitter: __ANAT | Facebook: http://bit.ly/bF9fXl

    The Australian Network for Art and Technology (ANAT) is supported by the Visual Arts and Craft Strategy, an initiative of the Australian, State and Territory Governments; the Australian Government through the Australia Council, its arts funding and advisory body, and the South Australian Government through Arts SA.

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: 2010-08-13, 07:49 AM
  2. Deleting relationships via the SOAP API
    By BrianV in forum Developer Help
    Replies: 0
    Last Post: 2010-02-09, 02:36 PM
  3. Replies: 2
    Last Post: 2008-07-08, 05:28 AM
  4. Replies: 6
    Last Post: 2005-12-17, 12:10 AM
  5. soap interface relationships
    By rusty in forum Developer Help
    Replies: 3
    Last Post: 2005-09-28, 03:21 PM

Tags for this Thread

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
  •