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.

How to add Requested item name field in Catalog Item Approval page?

ramireddy
Mega Guru

Hi,

I wants to show "Name of the item requested" field also in Approval page. Currently it's showing only "Request" number. But I wants to display the items as well that are requested as part of this request in Approval page. For example, If a "Computer" is requested as part of a REQ0001, I wants to show the name of the item "Computer" as well, while approving.

Screen Shot 2016-01-08 at 3.13.11 pm.png

I know, we can add fields by Personalizing form layout. However, I am not able to find the "fields", where request items can be displayed.

Screen Shot 2016-01-08 at 3.14.51 pm.png

1 ACCEPTED SOLUTION

divyalakshmi
Tera Guru

Hi Ram,



I have done a small change in the above code. Please use the below code


test();


function test()


{


var itemname='';


//gs.log("Approval For"+current.sysapproval);


var gr=new GlideRecord("sc_req_item");


gr.addQuery("request",current.sysapproval);


gr.query();


while(gr.next())


  {


  itemname+=(','+gr.cat_item);


// gs.log("itemname"+itemname);


  }



current.u_item_name=itemname;


  //gs.log("in"+current.u_item_name);


current.update();


}



This works fine if the new filed u_item_name is of type List. When you place order for multiple items this will return multiple item's name in the Approval form.


View solution in original post

5 REPLIES 5

Thank you,



My original requirement was to show/hide an existing field, based on this item. I am able to do it through a UI Policy, which called a script include.



Thanks


Rami Reddy