Client script pop up appearing for other users
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2024 01:21 PM
Hi,
We have a client script which presents a pop up when the priority is changed on incident. However, we noticed that if other users are viewing the same incident at the same time as the update being made, they too also see the pop up.
How do we only show the pop up only on the session where the update is being applied by a user?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 12:13 AM
Hi @Chaz_
can you please share the client script which you have written for creating pop up
Thanks & Regards
Sejal Chavan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 02:21 AM
Hi,
Here is the code - it is onChange of priority. We can't use MIM for this at the moment.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var newRec = g_form.isNewRecord();
var createdBy = g_form.getValue('opened_by');
var showText = 'xxxxxxxxx';
var noPopUser1 = 'xxxxxx'; //User 1
var noPopUser2 = 'xxxxx'; //User 2
if (newRec) {
if ((newValue == 1 || newValue == 2) && (!(createdBy.indexOf(noPopUser1) != -1 || createdBy.indexOf(noPopUser2) != -1))) {
if (!(confirm(showText))) {
location.reload();
}
}
} else {
if ((newValue == 1 || newValue == 2)) {
if (!(confirm(showText))) {
location.reload();
}
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 08:36 AM
You could wrap the whole thing if updated_by == g_user.userID
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 08:46 AM
Hi,
Would this work, as this is a client script and the record would not have been updated and sys_updated_by May need to be retrieved through a server side call?
I wonder if a BR would be better.