- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2020 07:06 AM
Hi All,
I have a Client Script- OnChange which should prevent the users when they try to select the Approved status on the Change task form from the Status field. The script is working fine and showing an error message as expected when they select the Approved value from the Status field. But the problem I am facing is when the task is approved by the user from the Approvers tab that time also I am seeing the same error message as the script is written on OnChange.
Is there a way to prevent the Client Script firing when the task is approved from the Approvers tab?
Any help is really appreciated!!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2020 12:48 PM
Hi Siva,
This issue occurs when we approve an item from approver's related list and status of the item changes to "Approved" without form refresh. This is called live updating and we need to make sure that your script does not run when there is a live update on the field you have written your onChange client script on.
You need to add an if condition in your client script something like below and it should work.
if(!g_form.isLiveUpdating()){
////your code
}
Please mark my answer correct if it works.
Regards,
Rajnish Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 06:52 AM
Hi Dirk,
Thanks for your reply.
I haven't tried your solution yet. I will try and update you the results.
Thanks
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2020 03:51 AM
Hi Dirk,
Thank you so much for your help. Adding g_form.isLiveUpdating()) to the if section of the client script preventing the Client Script firing when the field is updated by the system.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '' || oldValue == newValue || g_form.isLiveUpdating()) {
return;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2020 02:36 AM
H @siva
Thanks a lot the the feedback, I am happy that you solved the issue.
BR
Dirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2020 06:21 AM
Why not remove Approved option from the state field conditionally using Client Script ? In that case user will not be able to see the option in the dropdown.
Please mark my answer correct/helpful, if it helped you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 06:49 AM
Hi Rajneeshbaranwal,
Thanks for your reply!
I can not hide the approved option completely using the client script for now because of other reasons. I would like to keep that as my last option.
Thanks
Siva