We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

existing record validation on String Field

_bhishek
Tera Guru

Hi All,

 

I have an catalog item to create business Application .Business application is inserted after approvals. There is field as application name in catalog item which maps to Name field field of Business application in service now.

I want when user enters any name in Application name field of catalog item which is operation and existing already in service now business application table then user should get an message like "This application already exist " and there should be a Click here Hyperlink which takes to the list view of business applications which should show the applications with  ' name contains what users has entered in Application name string field. '
I tried with Script include and catalog client script(using HTML message) but that message is coming for few seconds and automatically goes and if again enter same name in string field then no message comes .I want like if user enters same name again and again then that message/error should be there with respective Hyperlink and user should be able to close that message/error.

Any pointer would be helpful.

 

Thank you. 

2 REPLIES 2

Aditya_hublikar
Mega Sage

Hello @_bhishek ,

 

 Have you tried g_form.showFieldMessage() method ?

 

example :

 

var link = '/cmdb_ci_business_app_list.do?sysparm_query=nameLIKE' + newValue;

var msg = 'This application already exists. ' +
                            '<a href="' + link + '" target="_blank">Click here</a>';

g_form.showFieldMsg(fiedlName, msg,'error', true);

 

 

 

If this helps you then mark it as helpful and accept as solution.

Regards,

Aditya

Ankur Bawiskar
Tera Patron

@_bhishek 

unless you share your scripts and screenshots we can't help

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader