Rest webservice, relating a document with an opportunity

Rest webservice, relating a document with an opportunity,
I would like to know how I can relate a document to an opportunity in suiteCRM, I am not succeeding for several days.

I am following this documentation, but I have not been able to
http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/Application_Framework/Web_Services

I can generate a new document,
I can also generate a new opportunity linked to a specific account.
But I did not see an example of relating a document to an opportunity.

HI,

here is how to Set relationship between Documents and Opportunities

http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/Application_Framework/Web_Services/Method_Calls/set_relationship/
and
http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/Application_Framework/Web_Services/Examples/REST/PHP/Relating_Quotes_and_Products/

if i’m not wrong, it should be something like this


 $relationshipParams = array(
        'sesssion' => $session_id,
        'module_name' => 'Opportunities',
        'module_id' => $Opportunity_id,
        'link_field_name' => 'documents',
        'related_ids' => array(
            $document_id 
        ),
        );
    
    $relationshiptResult = call('set_relationship', $relationshipParams, $url);
     

Hope it helps.
BM.

1 Like

Thank you boombata, you saved my day! My problem was with ‘module_id’, I was specifying the documents_opportunities relationship table.
Gratitude for your help. :cheer: :cheer: :cheer: