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.

Adding the owner of the catalog item for the notifications

phr
Tera Contributor

Hi All,

 

I have a requirement where for the catalog item "ServiceNow catalog Request" . Where under the "ServiceNow catalog Request" we have the variable which states "Request type" and the options are "New catalog item" , "Update existing catalog item" and "Remove existing catalog item " as shown below.

phr_1-1717739435703.png

 

phr_0-1717739407391.png

 

On selecting one of the option we have an another variable to choose a specific catalog item that is to be updated.

phr_2-1717739505907.png

We have a specific notification that is set up to receive the work notes update and as of now it is been configured that "Requested for" should receive , How do add the Owner of the catalog that is selected "AC_test_template" in the "who should receive" section?

 

Note( we have an option to add the ServiceNow catalog Request catalog item's owner but not the AC_test_template's owner) as shown below

phr_3-1717739718106.png

The notification should be sent to AC_test_template's owner but not the ServiceNow catalog Request's owner

How to achieve this?

1 REPLY 1

Appanna M
Tera Guru

Hello @phr ,

 

You can trigger the notification to the selected catalog item owner by creating a on change client script and script include to get the selected catalog item owner and set it to a variable on the catalog form and hide it(if you want). Then configure the notification - Item.<variable_name> 

//Script Include Function:

getOwner: function(catalogItemSysId) {
        var owner = '';
        var gr = new GlideRecord('sc_cat_item'); // Table for catalog items
        if (gr.get(catalogItemSysId)) {
            owner = gr.u_owner.toString(); // Assuming 'u_owner' is the field for the owner
        }
        return owner;
    },

 

Please Mark My Answer as Helpful and Accept as Solution, if you find this article helpful or resolves your issue.