Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Adding the "Item" field from Requested Items to "My Approvals"

ccurtis
Tera Contributor

I hope that there is someone that can assist me with trying to solve this issue. First off I want to say that I am not programmer by any means. With that said, I do understand basic code. What I am trying to do is edit the server side of a cloned Approvals widget so that I can get the "item" field from a requested item to display with the approval. I have added a couple of Screen shots of what I tried.

1 ACCEPTED SOLUTION

Bhavya11
Mega Patron

Hi @ccurtis ,

 

For that you need to clone the OOTB approval widget and need to modify the below 

 

in sever side script you need to add the 

  t.name= task.cat_item.getDisplayValue();
for reference:
Bhavya11_0-1722915960109.png

in HTML

need to add below lines

 

<div ng-if="approval.task.name"><label>${Catalog item}</label> {{::approval.task.name}}</div>

Bhavya11_1-1722916003920.png

 

Output:

Bhavya11_2-1722916033504.png

If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful.

 

 

Thanks,

BK

 

Regards
BK
LinkedIn: https://www.linkedin.com/in/bhavyashree-karanth-55032a121
YouTube: https://www.youtube.com/@NowWithBhavya

View solution in original post

3 REPLIES 3

Bhavya11
Mega Patron

Hi @ccurtis ,

 

For that you need to clone the OOTB approval widget and need to modify the below 

 

in sever side script you need to add the 

  t.name= task.cat_item.getDisplayValue();
for reference:
Bhavya11_0-1722915960109.png

in HTML

need to add below lines

 

<div ng-if="approval.task.name"><label>${Catalog item}</label> {{::approval.task.name}}</div>

Bhavya11_1-1722916003920.png

 

Output:

Bhavya11_2-1722916033504.png

If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful.

 

 

Thanks,

BK

 

Regards
BK
LinkedIn: https://www.linkedin.com/in/bhavyashree-karanth-55032a121
YouTube: https://www.youtube.com/@NowWithBhavya

ccurtis
Tera Contributor

Bhavya11 thank you for this, I have been banging my head against the wall on this for 2 days.

You're welcome! I'm glad I could help


Regards
BK
LinkedIn: https://www.linkedin.com/in/bhavyashree-karanth-55032a121
YouTube: https://www.youtube.com/@NowWithBhavya