Skip to content

Instantly share code, notes, and snippets.

@wave-inguane
Created August 3, 2021 22:06
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 wave-inguane/8c38bd4ba55f07b528cf7eb1e3f3c3a2 to your computer and use it in GitHub Desktop.
Save wave-inguane/8c38bd4ba55f07b528cf7eb1e3f3c3a2 to your computer and use it in GitHub Desktop.
spUtil
//A simple recordWatch function.
spUtil.recordWatch($scope, "live_profile", "sys_id=" + liveProfileId);
//In a widget client script
function(spUtil, $scope) {
/* widget controller */
var c =this;
// Registers a listener on the incident table with the filter active=true,
// meaning that whenever something changes on that table with that filter,
// the callback function is executed.
// The callback function takes a single parameter 'response', which contains
// the property 'data'. The 'data' property contains information about the changed record.
spUtil.recordWatch($scope, "incident", "active=true", function(response) {
// Returns the data inserted or updated on the table
console.log(response.data);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment