Regarding Update Alert script

matsui
Tera Contributor

I found Simultaneous Update Alert script my instance, but this did not work on custom application.(Global application has supported it)

How can I use this script on custom application ?

// Warn when two users are editing the same record
function onSubmit() {
var updatedOn = gel('onLoad_sys_updated_on').value;
if (!updatedOn)
return;

var gr = new GlideRecord(g_form.getTableName());
if (!gr.get(g_form.getUniqueValue()))
return;

var dbUpdatedOn = gr.sys_updated_on + '';
var dbUpdatedBy = gr.sys_updated_by + '';
if (updatedOn != dbUpdatedOn)
return confirm(new GwtMessage().getMessage("{0} updated this record since you opened it - overwrite with your changes? Additional comments and Work notes will not be overwritten.", dbUpdatedBy));
}

 

 

2件の返信2

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

You should not do this in an onsubmit client script.

Use of gel or GlideRecord form client script is against the best practices.

 

What are you trying to achieve here? What logic you are truing to implement?

-Anurag

@Anurag Tripathi I want to avoid multiple users updating the same record.

This script met my requirements but I can't use it, so I would like to know how to meet it somehow