Add index into contacts_aos_products_1_c (Relationship table)

Hi everyone,

My name is Martin, I have created a relationship between Contacts(service) and Products
In my case, I want to add a double relationship between Contacts and Products with other field that is that make the difference

Product A - Contact A - Customer (Role Added as new field) - Customer B (Link of person that receive the service)
Product A - Contact A - Buyer (Role Added as new field)

I try to use web service function set_relationship but only one record is added the other is ignore
I have checked database and I see there are two indexes : PRIMARY and contacts_aos_products_1_alt (contacts_aos_products_1contacts_ida and contacts_aos_products_1aos_products_idb)
So I added a new field in this index by database but nothing happens

How to modify function set_relationship or how to modify to able this change

Thanks in advance

Best regards from Perú

Martin Contreras

Do you mean you want to add a custom field to the relationship itself? I mean, the new field is not in the Contact, it’s not in the Product, it’s in the relationship between both?

If so, check this out:

http://sugarmods.co.uk/how-to-add-custom-fields-to-a-relationship-table-and-display-them-in-a-subpanel-sugarcrm-suitecrm/

and then some extra insights about that post are here:

https://suitecrm.com/forum/developer-help/8797-how-create-custom-field-on-accounts-contracts-relatiship-module

Hi,

Thanks for your reply, I added a new field.
My question is if function set_relationship in rest api create or update if I pass the sames ids in tables contacts and aos_products
I added a new field in index in this relationship table

I have created in my case

$relationshipContactCourseParams = array(
‘sesssion’ => $session_id,
‘module_name’ => ‘Contacts’,
‘module_id’ => $idPersonaAlumno,
‘link_field_name’ => ‘contacts_aos_products_1’,
‘related_ids’ => array(
$idCurso
),
‘name_value_list’ => array(
),
‘deleted’ => 0,
);

                $relationshipInscripcionResult = $this->call('set_relationship', $relationshipContactCourseParams, $this->url);

In this case module_id and related_ids are the same with the difference I added a new field (the one that makes the difference)

Or how to create a guid by webservice to insert duplicates records in this relationship table

Thanks in advance

Martin

I’m sorry, but I don’t have any experience with the REST interface, I can’t help you there…