Check if value is updated by user or not
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 09:20 AM
Hi,
In onchange client script i wanted to check if the field value is updated directly by user or by another client script.
For example there are 3 fields a,b,c
based on value of b, the value of c will automatically change. (first client script on field b)
Now i wrote a onchange client script on field c.
My requirement now is : If I manually change value of c then client script should trigger. If the value of c is updated by first client script mentioned above then my new client script should not trigger.
How can i determine it?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 10:04 AM
Just imagining this scenario, if this not documented very well, any new developer will go crazy about the idea.
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 10:17 AM
Was trying things out on a PDI and this seemed to work:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var who = g_form.sys_updated_by;
if (newValue != '' && who == 'system') {
g_form.addInfoMessage("System updated the field");
}
if (newValue != '' && who != 'system') {
g_form.addInfoMessage("User updated the field");
}
}
Although for Choice fields you may need to list the possible values in the "if" checks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 10:52 AM
Hi
correct me if I'm wrong but
g_form.sys_updated_by
returns the user who has last changed the record but not which script is firing on client-side at the moment the user works with the form
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 12:15 PM
It was a quick test, so may not have been the most thorough on all possibilities. Got called away so never fully tested.
Ok, so I went back and tested it fully with a Client Script to trigger an update to a field. Maik was right, 'sys_updated_by' can't be used in this respect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2022 09:40 AM
Yes it did not work. It is taking updated value from database and not on form.