How do you add a Confirm Message within a Business Rule

lindac
Kilo Explorer

I am currently using the following function within an Business Rule to populate the RFC field on the incident table from Change. As is, it is working correctly, but the process owners now would some changes. What they want is a check to see if the RFC is populated. If it is already populated with a change number then they want a pop-up message indicating that there is a value already entered and if they wish to continue. If yes, then it will overwrite the number otherwise leave it as is.

Can a check and confirmation be added, and if so, how.

function updateRelatedRFCInc(){
var relInc = new GlideRecord('incident');
relInc.addQuery('sys_id',current.u_child_incident);
relInc.query();
if (relInc.next()) {
relInc.rfc = current.sys_id;
relInc.update();
}
}

Thank you,

Linda

1 REPLY 1

ShaneBrazeal
Tera Contributor

Hi Linda,

There is no way to popup a confirm server side, so you can to switch it to an onSubmit client script, close to the following...



function onSubmit(){
var relInc = new GlideRecord('incident');
relInc.addQuery('sys_id', g_form.getValue('u_child_incident'));
relInc.query();
if (relInc.next()) {
if(relInc.rfc == "" || confirm("Do you want to update the incident?")){
relInc.rfc = g_form.getUniqueValue();
relInc.update();
}
}
}