Question

I am using the sugar rest api get_entry_list to get certain notes related to a particular lead. Suppose lead x has 5 notes attached to it and 2 of those notes has test in the name field. I want to get just those 2 notes, not all 5 of them.

I have tried setting the query attribute to:

id = x and name='test'
id = x and notes.name='test'
leads.id = x and notes.name='test'

What should my query be?

Was it helpful?

Solution

The get_entry_list method is good for searching the Leads module for leads, but not so good for getting the lead with id x and then searching notes associated with that lead. For the query parameter, leads.id = 'x' is the way to go, although it won't let you query notes by using notes.name='test'. To get all notes for this lead, you could wrestle with the link_name_to_fields_array parameter, although you still can't say which notes to get by specifying a query.

Instead, try using the get_relationships method: http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.7/02_Application_Framework/Web_Services/05_Method_Calls/get_relationships/

suggestions for parameters:

module_name: "Leads"
module_id: "x" (the id of the lead you're interested in)
link_field_name: "notes"
related_module_query: "notes.name LIKE '%test%'"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top