How to replace GlideScriptRecordUtil in Scoped applications ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2016 04:35 AM
We are developing a custom scoped application for PPM .
Requirement is to update a record feed of a project , when a new status update(using Status Updates -Related list ) record is created.
I have created the Table notification for the same and it is throwing me the following error when a new status update is created.
GlideScriptRecordUtil is not allowed in scoped applications
I did check and came to know business rule created by Table notification is causing this , Business rule script contains
function onBefore(current, previous) {
//This function will be automatically called when this rule is processed.
var gru = new GlideScriptRecordUtil.get(current)
var fieldsChanged = gru.getChangedFieldNames();
gs.eventQueue('live_feed.update', current, fieldsChanged.toString(), current.sys_mod_count);
}
Is there any replacement for this GlideScriptRecordUtil class in Scoped apps?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2016 11:04 AM
No update, other than the fact that the API is not supported anymore. I can't really speak about future plans, but right now it does not seem that there are plans to bring that API back.
In terms of the "changed fields" part of the API, you should be able to implement a fairly simple workaround using getElements() and changes() yourself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2016 11:21 AM
Thanks , do you have any examples. I searched online could not find anything relevant.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2016 06:35 AM
Try this:
function getChangedFieldNames(gr) {
var result = [];
var elements = gr.getElements();
var size = elements.size();
for (var i = 0; i < size; i++) {
var ge = elements.get(i);
if (ge.changes()) {
result.push(ge.getName());
}
}
return result;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2017 01:37 PM
Thanks for posting this, I was finally able to revisit and with slight changes i was able get this working.
function getChangedFieldNames(gr) {
var result = [];
var elements = gr.getElements();
var size = elements.length;
for (var i = 0; i < size; i++) {
var ge = elements[i];
if (ge.changes()) {
result.push(ge.getName());
}
}
return result;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2017 01:49 PM
Another work around is to create a new Global script include that is available to all scopes. Create a function that accepts the current record, executes the API call mentioned above, and then returns the list of changed fields.