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.

Need to populate the alert on the form level

vinuth v
Tera Expert

Hi All,

 

I am working on the on of the form in this form I have requirement link when on Submit of the form I need to display the alert and form is not getting submitted(need to restrict the form submission only alert need to display when user click on the submit button)

 

I tried like below, in the alert message I have URL as well but I am getting error like below when I trying to save the onSubmit script.

 

vinuthv_0-1708080519009.png

Please any one provide me the input,

Thanks,

Vinuth

6 REPLIES 6

vinuth v
Tera Expert

I tried like below and it's working fine

 

function onSubmit() {
//Type appropriate comment here, and begin script below
var urlString = "https://techtoc./non-functional/security/application-security/static-application-security-testing/sn...";
alert(" terminating on April 1, 2024 and all SAST/SCA has transitioned to . All GitHub and ADO repositories are already being scanned. Please login at https://snyk.com to start reviewing your scan results. You can review  onboarding documentation here:"+" "+urlString);

return false;

}

Community Alums
Not applicable

Hi @vinuth v 

Try adding this logic...

 

var link = '<a href="URL_HERE">TEXT TO BE Displayed</a>';
var message = gs.getMessage('TEXT_IN_ALERT') + ' ' + link + ' ';
gs.addInfoMessage(message);

 

 Please mark as helpful or if its resolved the issue, CORRECT!

Andrew Robinson
ServiceNow Developer

AndrewRobinso1_3-1708084013016.png Follow me on Linkedin!