Notification trigger in approval table and body passing dynamic but customer need catalog descripti

Not applicable

Notification trigger in approval table and body passing dynamic,  but customer need catalog varaible description 

 

How can I acces catalog varaible description in notification.

1 ACCEPTED SOLUTION

\Hi,
Your query is wrong in GlideRecord.

 


Thanks and Regards,

Saurabh Gupta

View solution in original post

7 REPLIES 7

Danish Bhairag2
Tera Sage

Hi @Community Alums ,

 

In this case u need to use email script functionality in notification here where u can write a GlideRecord query n fetch the catalog description.

 

Please check this link for email script creation n how to use in servicenow

https://developer.servicenow.com/dev.do#!/learn/learning-plans/utah/new_to_servicenow/app_store_lear...

 

Thanks,

Danish

 

Not applicable

Hi @Danish Bhairag2 

 

Can u pls provide source code for that one

Hi @Community Alums ,

 

Sure. Please find the code which needs to be written in email script

 

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {

    // Add your code here

    var gr = new GlideRecord("sc_cat_item");
    gr.addQuery("sys_id", "enter value of ur catalog item sys id");
    gr.query();
    if (gr.next()) {
        template.print(gr.description); // if u want to print short description modify the variable name accordingly
    }


})(current, template, email, email_action, event);

 

Thanks,

Danish

 

Not applicable

I getting like  output undefined, and i applied on sc_req_item table it not showing anything in output.

Let me know any update on my code.