- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2022 12:16 AM
Hi Guys,
i have requirement Requested for need to check to two table condition after we need to display users in requested for variable and also we need to show some field message to that variable he is having license or not. through script include and catalog client script we can archive but without catalog client script how we can archive this. may i know how to archive through UI macro
script include:
var get_requestedfor = Class.create();
get_requestedfor.prototype = {
initialize: function() {},
getHelloWorld: function() {
var gr = new GlideRecord('u_alm_service');
gr.addEncodedQuery('model.short_descriptionSTARTSWITHSFW091^install_statusNOT IN2,1'); //YOu can use your query here
gr.query();
while(gr.next()) {
//gs.print("print value2 "+gr.sys_id);
var tb = new GlideRecord('sys_user');
tb.addQuery('sys_id',gr.u_requester);
//gs.print("print value1 "+tb.sys_id);
tb.addEncodedQuery('u_employee_type=Subcontractor^u_capgemini_o365_planISNOTEMPTY'); tb.query();
while(tb.next()) {
//gs.print("print value "+tb.name);
return tb.name;
}
}
},
type: 'get_requestedfor'
};
we need show like below
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2022 12:53 AM
Hi Mani,
If you want to display the message in red color then you can try below onLoad client script.
g_form.showFieldMsg('requested_for','The message which you want to display','error');
Please mark this as correct and helpful if it resolved the query or lead you in right direction.
Thanks,
Mohit Kaushik
Community Rising Star 2022
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2022 12:47 AM
Hi Mani,
You can configure a catalog OnLoad client script for this. UI Type=ALL
g_form.showFieldMsg('field_name','Your Message','info',false);
or
g_form.showFieldMsg('your_variable_set_name','Message','info');
or
g_form.showFieldMsg('<field name>', '<message text>', '<level>');
The default for this is blue under the field.
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2022 12:53 AM
Hi Mani,
If you want to display the message in red color then you can try below onLoad client script.
g_form.showFieldMsg('requested_for','The message which you want to display','error');
Please mark this as correct and helpful if it resolved the query or lead you in right direction.
Thanks,
Mohit Kaushik
Community Rising Star 2022
Mohit Kaushik
ServiceNow MVP (2023-2025)