Jagan
Jagan

Reputation: 620

SugarCRM relationship to get contacts from active opportunities

I am working on sugarCRM, I need to get all the contacts from active opportunities. I can relate the contacts with Opportunities for single record using the below url

https://xxxxxxxx.trial.sugarcrm.eu/rest/v10/Opportunities/5ae1907a-9408-178f-87d6-523cc7d679b6/link/contacts

But I have to get he contacts details for all opportunities which is active. Can Anyone please help me.... Thanks in advance

Upvotes: 3

Views: 290

Answers (1)

Amitesh Kumar
Amitesh Kumar

Reputation: 3079

you are going right , The url provide by:

https://xxxxxxxx.trial.sugarcrm.eu/rest/v10/Opportunities/5ae1907a-9408-178f-87d6-523cc7d679b6/link/contacts

It will give all record related to that Opportunities.

But you want All contacts of active Opportunities

  1. First you need to hit API for Opportunities which is active :

    https://xxxxxxxx.trial.sugarcrm.eu/rest/v10/Opportunities/filter[0][status][$in][]=active

Like this you can apply filter.

For more help check this link

2.Now after that you get array on Opportunities , so will use loop get get Opportunities id and hit your URL.

https://xxxxxxxx.trial.sugarcrm.eu/rest/v10/Opportunities/5ae1907a-9408-178f-87d6-523cc7d679b6/link/contacts

You can make Dynamic according to your need. I hope this will help you.

Upvotes: 3

Related Questions