Confirm pop up before submitting a record

Payal5
Kilo Expert

Hi All,

I'm trying to add a confirm box before submitting a new record.I'm using below client script for this,

function onSubmit() {
//Type appropriate comment here, and begin script below
if(g_form.isNewRecord())
{
var valR=g_form.getReference("escalation_severity",popEscType); //Reference field
}
function popEscType(valR)
{
if(valR.name=='Management')//Management
{
var answer = confirm("Do you have the management approval to perform this escalation?");
if(answer == false)
{
return false;

}
}
}
}

 

After using this script i'm getting a confirm box .

But after clicking on cancel ,new record is still getting submitted.

Please tell me what is wrong in this script.

 

Thanks!

 

 

1 ACCEPTED SOLUTION

if you dont want to use sysid then use

g_form.getDisplayBox('<reference field name>').value;

View solution in original post

3 REPLIES 3

Hi 

I was using below script ,

//Type appropriate comment here, and begin script below

if(g_form.isNewRecord())
{
var val = g_form.getValue('escalation_severity');
if(val=='7de67373b3500300ff6e6e5f26a8dcc9')//Management
{
var answer = confirm("Do you have the management approval to perform this escalation?");
if(answer == false)
{
g_form.addInfoMessage("Escalation cancelled");
return false;
}
}
}

 

It was working fine but i don't want sys_id in script.So I'm using g_form.getReference(), But it is not working as per the requirements

 

Can you please help me

if you dont want to use sysid then use

g_form.getDisplayBox('<reference field name>').value;