How to write warning message in catalog items using UI policy ?

C_S3
Tera Contributor

How to write warning message in catalog items using UI policy ?
Can someone please assist me regarding this query? I have written a UI Policy but its still not showing message.

1 ACCEPTED SOLUTION

hello @Chandni Shah 

no need of scripting here 

just put the condition of the UI policy as 

date field before today 

and in script use the message g_form.addWarningMessage('your message') in "execute if true" field 

 or g_form.showFieldMsg("field name', 'Warning msg');

make sure you select the type as ALL in the run script 

Hope this helps 

mark my answer correct if it helps you

View solution in original post

9 REPLIES 9

Mohith Devatte
Tera Sage
Tera Sage

Hello @Chandni Shah ,

you can use this 

g_form.addWarningMessage('your message');

mark my answer correct if it helps you

Pavankumar_1
Mega Patron

Hi,

you can try it on client scripts to display the field message.

 

Thanks,

Pavankumar

 

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

SumanthDosapati
Mega Sage
Mega Sage

Hi @Chandni Shah 

In the screenshot you mentioned, there is a field  "Run scripts in UI type"

Change its value from Desktop to ALL.

 

Mark as correct and helpful if it solved your query.

Regards,
Sumanth

Kristen Ankeny
Kilo Sage

A couple possible items:

- for showFieldMsg you need type as the third parameter (or you can use showErrorBox instead to not need to have the type)

- If you're viewing the form in the portal, you need to update the "Run scripts in UI type" to all

- The field name would be the backend name (just mentioning because the example doesn't follow backend naming conventions with underscores).

However, I would be inclined to do this in a catalog client script (onchange for the trigger field) rather than in the ui policy.