Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Show submitted requested item form via email or ESC

athavichith
Mega Sage

Is there a way I can show the submitted requested form through email or ESC? For example, the fulfiller has access to the native UI and see the form this way: 

 

athavichith_0-1749236995912.png

 

 

Where as customers who only has access through ESC, can only see the form this way:

athavichith_1-1749237069000.png

 

1 REPLY 1

YaswanthKurre
Tera Guru

Hi @athavichith ,

 

If you want to show the submitted form through an email, you can build a notification and by using email script and copy the field name and field values in it.

 

mail script:

(function runMailScript(current, template, email, email_action, event) {
    template.print('Request Details<br>');
    var item = new GlideRecord('sc_req_item');
    item.addEncodedQuery('sys_id='+current.sys_id);
    item.query();
    if(item.next()) {
      var options = new GlideRecord('sc_item_option_mtom');
      options.addEncodedQuery('request_item.number=' + item.number + '^sc_item_option.value!='); 
      options.orderBy('sc_item_option.order');
      options.query();
        while (options.next()) {
            var option = options.sc_item_option.item_option_new;
            var optionName = option.name;

            template.print(option.getDisplayValue() + '<br>');
            template.print(item.variables[optionName].getDisplayValue() + '<br>');
        }
    }
})(current, template, email, email_action, event);

 

Please mark this as helpful and correct if this solves your issue.

 

Thanks,

Yaswanth