Need to change "requested for" for catalog items

Abhishek Rai
Tera Contributor

Hello Everyone,

I have a problem with service catalog whenever any one requested on behalf of any other user. Then after raising the request it will set requested for as the the requestor not "on behalf of user"

Variable set is also fine see the below picture see the attachment,

The question what need to be set so that when i select another user and raise the request then it need to set the requested for as the user for whom i raised the request "on behalf of user" not my name.

Please suggest if any one have solution of that issue.

Thanks in Advance

Abhishek Rai

 

 

 

 

5 REPLIES 5

SumanthDosapati
Mega Sage
Mega Sage

Hi @Abhishek Rai ,

In your workflow after the begin activity, you can add a run script activity and add below script

current.requested_for = current.variables.requested_for;
current.update();

 

Mark as correct and helpful if it solved your query.

Regards,
Sumanth

Voona Rohila
Kilo Patron
Kilo Patron

Hi Abhishek

Requested for field on RITM is dot-walked field from req so we need to update req record.

Try this

var req= current.request.getRefRecord();
if(req.isValidRecord()) { // << only perform operations on it if it's a valid record
req. = current.variables.requested_for;
req.update();
}

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

are you saying requested_for on REQ shows logged in user? If yes then that's platform behavior.

You will require script to update it

Use after insert BR on RITM table or you can use workflow run script in your catalog item's workflow

Script would look like this

var req = current.request.getRefRecord();
req.requested_for = current.variables.requested_for;
req.update();

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Abhishek Rai 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader