Created
May 23, 2018 00:57
-
-
Save elchele/1f4aa6e396ffe610be839346a291e0fd to your computer and use it in GitHub Desktop.
Invoking code on a successful response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myCustomJSMethod: function(module, guid){ | |
//Instantiate a SugarBean object representing record identified by GUID | |
var beanObject = app.data.createBean(module, {id:guid}); | |
//Send request to REST v10 API to retrieve the record | |
beanObject.fetch({ | |
//Define the anonymous function that will execute on a successful response | |
success: function(data){ //the data parameter represents the JSON response from the API | |
//Do something with the response upon successful request | |
console.log(data); //This will simply output response to JS console | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment