How to get Request for (selected user) email id ?

Manjunath6
Kilo Contributor

Hi,

I need to get Request For (selected user) email id.

Ex:

I have logged in to developer instance as 'System Admin' and i will goto Service Portal > Service Catalog then i will click order now button, then in 'Request For' i will select some user (as shown in screenshot)

find_real_file.png

So, in studio business rule, How can i get request for user (Abel Tuter) Email address.

Note: I tried below script, but this gives me system admin email id not Request for user email id.

var myUserObject = gs.getUser();
gs.addInfoMessage('mail = '+myUserObject.getEmail());

 

Please help me to get Request for (selected user) user email id.

Thanks You.

1 ACCEPTED SOLUTION

This was close but the requested for var is not actually a var it is a field on the sc_request table. So the br would run on the ritm table and to access the value it would be.

 

current.request.requested_for.getDisplayValue() for the name or

current.request.requested_for.toString() for the sys_id

View solution in original post

5 REPLIES 5

Calvaresi E_
Giga Expert

Hi Manjunath,

I didn't really understand your question. If you need to get the requested for email, you can just dot-walk like this:
var temp = current.requested_for.email; (if you are in a BR on Request table).

Or current.variables.requested_for.email if it is a variable of a form.

Let me know if it helps.

 

Hi edoardo.c,

My question is, When i click on order now in 'Service Portal' page with my own 'Service catalog' items (below screenshot),

find_real_file.png

It will show popup with 'Request For' option (screenshot attched in my previous question), where we need to select the user, Then this request will create on behalf this selected user.

So, I need to get the Email id of that request for selected user in my business rule (script) .

(Note: These script

var temp = current.requested_for.email; Or current.variables.requested_for.email;

didn't work)

Please help me to resolve this issue.

Thanks.

Try the accepted answer from this link and check once.

https://community.servicenow.com/community?id=community_question&sys_id=2c8583eddbd8dbc01dcaf3231f96...

Mark the comment as a correct answer and also helpful if it helps.

This was close but the requested for var is not actually a var it is a field on the sc_request table. So the br would run on the ritm table and to access the value it would be.

 

current.request.requested_for.getDisplayValue() for the name or

current.request.requested_for.toString() for the sys_id