Client script pop up appearing for other users

Chaz_
Tera Guru

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.

7 REPLIES 7

sejal1107
Tera Guru

Hi @Chaz_ 

can you please share the client script which you have written for creating pop up

Please check and Mark Helpful and Correct if it really helped you.
Thanks & Regards
Sejal Chavan

Chaz_
Tera Guru

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();
            }
        }
    }
}

You could wrap the whole thing if updated_by == g_user.userID

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.