The CreatorCon Call for Content is officially open! Get started here.

please help me how to display field message into catalog variable with catalog client script

mani55
Tera Contributor

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

find_real_file.png

 

1 ACCEPTED SOLUTION

Mohit Kaushik
Mega Sage
Mega Sage

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

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

View solution in original post

2 REPLIES 2

Community Alums
Not applicable

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

Mohit Kaushik
Mega Sage
Mega Sage

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

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)