- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2021 12:34 PM
Hi Community!
I have created a catalog client script for showFieldMsg using 'warning' and it currently shows up just fine with the orange background color and the text is black. However, our client wants this to appear in a black background with white text. How can I achieve this? Here is the current code:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var choice = g_form.getValue('app_media');
if (choice == 'Yes'){
g_form.showFieldMsg('app_media', "This is a test message", 'warning');
}
}
How can I achieve the below result?
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2021 12:49 PM
Hi,
You cannot do this with a showFieldMsg, as it only allow you to show a msg or an error.. Alternatively,
What I think you can do is:
Add Html variables and make their visibility as tru or false through ui policy or client script based on the other variable the user is clicking.
For info on catalog variable types, pls refer here:
https://docs.servicenow.com/bundle/rome-servicenow-platform/page/product/service-catalog-management/reference/r_VariableTypes.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2021 12:49 PM
Hi,
You cannot do this with a showFieldMsg, as it only allow you to show a msg or an error.. Alternatively,
What I think you can do is:
Add Html variables and make their visibility as tru or false through ui policy or client script based on the other variable the user is clicking.
For info on catalog variable types, pls refer here:
https://docs.servicenow.com/bundle/rome-servicenow-platform/page/product/service-catalog-management/reference/r_VariableTypes.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2021 01:05 PM
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var choice = g_form.getValue('app_media');
var message = '<p style="color:white;background-color:black;"> Test Message </p>';
if (choice == 'Yes'){
gs.addInfoMessage(message);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2021 01:13 PM
Thanks Sai. I realize you can do this with an addInfoMessage, but the client wants it to appear just below the variable on the form instead of at the top of the screen. Great idea though! I may have to just go with
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2021 01:22 PM
yeah you can create widget/custom variable and make it visible using UI policy.