Petr
24 July 2014 13:54
#1
Hi,
I’m working through the crm API (v4_1) on the ‘Cases’ module.
Here is my (NodeJS) query to get my cases :
params = {
session: sessID
,module_name : "Cases"
,query : "cases.assigned_user_id='1'"
,order_by : 'date_modified DESC'
,offset : '0'
,select_fields : [ 'id','name','date_entered','date_modified','modified_user_id','created by',
'description','deleted','assigned_user_id','case_number','type',
'status','priority','resolution','work_log','account_id','state']
,link_name_to_fields_array : [{ name: 'accounts', value: [ 'name', 'billing_address_city']}]
,deleted : '0'
,Favorites : false
};
sugar.call("get_entry_list", params, function(jsonres,err){
if (err) { console.log("Error : "+err); } else { res.json(jsonres); }
});
I need to get (and post) the internal updates.
Updates are stored in the ‘aop_case_updates’ table, so I don’t know how to do…
How can I solve my problem?
Jim
28 July 2014 11:01
#2
Hi Petr,
The case updates are stored in the AOP_Case_Updates
module. This can be used in ‘module_name’.
Examples of getting and creating via the REST API (although using PHP not NodeJS) can be found in the SuiteCRM Joomla Portal component . In particular com_advancedopenportal/sugarRestClient.php and com_advancedopenportal/SugarCasesConnection.php. I’m not familiar with node but can post some examples in PHP here if you need clarification.
Hope this helps,
Jim
1 Like
Petr
29 July 2014 07:10
#3
Thank you, this is what I was looking for!
I’ve got some very good examples of API queries.
For Node, API queries are basically the same as PHP, only the syntax is different.
And there is this module for Sugar .
Petr
29 July 2014 08:47
#4
And yes, I’m not so much familiar with js syntax too. I had some problems on the arrays into : ‘link_name_to_fields_array’, and on the modules names.
Here is a full working example using node-sugarcrm-client, in case somebody is looking for one in javascript :
sugar.init({apiURL: "http://mysuiteinstance.com/service/v4_1/rest.php",login:"mylogin" ,passwd:"mypasswd"});
sugar.login(function(sessionID){
if (sessionID !== 'undefined') {
sessID = sessionID;
} else {
console.log("***** can't login, check your credentials");
}
});
params = {
session: sessID
,module_name : "Cases"
,query : "cases.assigned_user_id='1'"
,order_by : 'date_modified DESC'
,offset : '0'
,select_fields : [ 'id','name','date_entered','date_modified','modified_user_id','created by',
'description','deleted','assigned_user_id','case_number','type',
'status','priority','resolution','work_log','account_id','state']
,link_name_to_fields_array :
[{ name: 'accounts', value: account_fields},
{ name: 'aop_case_updates', value: aop_case_update_fields}]
,max_results : -1
,deleted : '0'
,Favorites : false
};
Hi,
i want use suite crm through java api please some links or examples how to do this .
thanks
You’ll need either a SOAP or REST library for Java (though you could make calls to the REST API manually). How this is used depends on the library chosen but the joomla portal component and http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.5/02_Application_Framework/Web_Services/05_Method_Calls/ should both be good references.
Thanks,
Jim