Skip to content

Instantly share code, notes, and snippets.

@vratiu
Last active November 19, 2023 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vratiu/23ff5b9b588ac4478c573eea12e4f33d to your computer and use it in GitHub Desktop.
Save vratiu/23ff5b9b588ac4478c573eea12e4f33d to your computer and use it in GitHub Desktop.
Sidecar CheatSeet
//create a bean from console
var callbean = App.data.createBean('Calls', {
"name": "issue 80737 call log",
"date_start": "2016-10-08T03:15:30+00:00",
"duration_minutes": 15,
"duration_hours": 0,
"assigned_user_id": "6ff50560-3589-23fa-eced-56ebf8835e3d"
});
// save the bean to server
callbean.save();
// fetch existing bean
var retbean = App.data.createBean('Calls', {id:"29300593-a362-640b-0f9a-577f9e45637a"});
//fetch it from the server
retbean.fetch();
//also grab related collections
retbean.fetch({related: true});
//get related bean Collections
retbean.getRelatedCollection("activities")
//get sugar auth token
App.api.getOAuthToken();
// build a link url "rest/v10/Calls/123/link/assigned_user_link/345"
App.api.buildURL("Calls", "assigned_user_link", {id:"123", "link":true, relatedId:"345"});
//call ajax
App.api.call("create", linkUrl);
//global search a module
App.data.createMixedBeanCollection().fetch({limit: 20 , module_list:['KBContents'], query: "slow internet"});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment