Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

GlideModal for Record Producer on Submit

EricG2
Mega Guru

Hi All:

 

Our company recently had a Health Check done, and my I say, from past experiences, I like the new spreadsheet results.

 

But to that point, I'm attempting to remove my lazy bad habit and convert all my Browser prompts to GlideModal.

(not easy after 15+years).

 

For most of my Catalog items, where I'm doing field validations, the glide_confirm_basic has worked fine.

 

Now, with the same popup, I'm trying to wrap my head around the OnPrompt functions.

Most of the posts i've seen are about UI actions.

 

What I want to do is, on a Cat Item or RP, prompt the user "Are you Sure you want to continue?".

 

I've written my onSubmit Client Scrip as follows:

function onSubmit() {
var answer = new GlideModal("glide_confirm", false, 600);
answer.setTitle("Attention");
answer.setPreference("title", "Are you sure you want to sent this outage?");
answer.setPreference("warning", "false");
answer.setPreference("onPromptSave", function(){return true});
answer.setPreference("onPromptCancel", function(){return false});
answer.render();
}

This is doing nothing and the form is submitted anyway.

 

If i add typical functions to the lines, I can test each fire but I'm not able to get the form to move forward.

answer.setPreference("onPromptSave", mySave);
answer.setPreference("onPromptCancel", myCancel);
answer.render();
return false;

}

function mySave(){
     return true;
}

function myCancel(){
     return false;
}


I'm not sure where I'm going wrong or if using Browser prompts isn't a good thing.

If you can share some examples or where this is better explained.   I would be very appreciative.

 

 

 

1 REPLY 1

ErezL
Tera Contributor

Hey,

Did you manage to open the GlideModal through the record producer?