- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2016 01:45 AM
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.
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2016 03:30 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2016 02:01 AM
Hi Ram,
Approval for field is referencing Task table so it is not possible to get the requested item name directly. However you can see the Requested item number and its detail when you configure the form layout by moving Approval summarizer from left slush bucket to right slush bucket.
The other way is to glide the requested item table with the request number(Approval for) and get the item name in some new field in the Approval form.
Let me know if this solves your problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2016 02:04 AM
Hi Divya Lakshmi,
Approval summarizer is already displaying in the form. But i need this value for a certain business logic. So, I wants to display as a separate field.
Can you give me more details about the second approach, "glide the requested item table with the request number(Approval for) and get the item name in some new field in the Approval form.". How to implement this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2016 02:57 AM
Hi Ram,
You need to create a new field of type list or reference in Approval form, the field should reference to catalog item table.
Write a before insert Business Rule on Approval Table. Follow the below code and it is displaying the item name in Approval form
Here u_item_name is the new field of List type.
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();
}
Let me know if this works for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2016 03:30 AM
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.