- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2017 04:00 AM
and cause mayhem
Does anyone know if there is a useful method (passed to the one change script, perhaps), that I could use to see if the update to the field was by the user (manually via his web browser) or due to the livefeed updating such a field (in which case, we may not trigger the script, and just return early).
Currently the following occurs:
User 1 and User 2 view an incident. User 1 updates and saves the record.
User 2 viewing this record, see's this live update ("User 1 has modified this field value") beneath a field. This field has a "on_change" script on it, which is then triggered which sets work notes to mandatory >> Now user 2 must fill in work notes, or, have to reload the form, then redo whatever changes they may have made.
Not ideal.... [ User 2 shouldn't be forced to justify the form change, but is, because the web page just sees something changed ].
Thus, i'd like to make a script adjustment of:
if (userUpdatedField != me)
return;
//Else continue to run script, as the user made the change so all is well.
Thanks all
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2017 03:00 PM
Just found that it is in fact documented so I did not need to go find this in the code. https://developer.servicenow.com/app.do#!/api_doc?v=istanbul&id=r_GF-isLiveUpdating
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2017 02:53 PM
Hi Chris,
I looked at the code behind the live form update and I found that the script is setting a g_form attribute before modifying the value on the field and setting back that attribute when it's done updating the form.
So the condition you are looking for is:
if(g_form.isLiveUpdating())
return;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2017 03:00 PM
Just found that it is in fact documented so I did not need to go find this in the code. https://developer.servicenow.com/app.do#!/api_doc?v=istanbul&id=r_GF-isLiveUpdating
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2017 04:56 AM
Hi Laurent,
Apologies, I reviewed the API and clearly missed that method!
That does the job! Nice.
Thank you