I'm using PHP Rest Service Version 4.1 and have spent three days trying to set a relationship between a record that I have just created via Rest and another existing record without success.
I have tried every combination of code that I can think of. The result always say that one relationship was created but the records are never actually related.
I have left the name_value_list array empty or off completely like the examples. I'm not sure what, if any, values may need to be in the attribute. Could this be the issue?
$partner_bean = '94597c8b-1a4e-6a20-81d9-51e6d7e764c8'; // This is the ID of Partner Record that already exists
//Set Related Partner Field
$set_relationship_parameters = array(
'session' => $session_id,
//The name of the module.
'module_name' => 'stu_Students',
//The ID of the specified module bean. ***
'module_id' => $document_id, // This is the ID of the newly created Partner Record
//The relationship name of the linked field from which to relate records.
'link_field_name' => 'stu_students_accounts', // This is the related field name, the Stu_Students module is the primary module for this field/relation
//The list of record ids to relate
'related_ids' => array(
'name_value_list' => array(), // I have left this empty like the examples. Could this be the issue?
$set_entry_result = sugarapi_call("set_relationship", $set_relationship_parameters, $url);