- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 04:49 AM
Hi everyone, how are you?!
In order for me to be able to get the value of the "email" field, I initialize it using the form in the first
table (cmdb_cit_business) then I need to do a dot walk, in two different tables, because the field is a reference (Business Parnet Department) PRINT_1:
Within this field there is another table (cmn_department) where there is the "Holder" field (which is also a reference field) PRINT_2
In turn, there is another table (sys_user), this will have the email field, which I need to get the value of. PRINT_3
I tried to do it this way, but it's not working, does anyone have any suggestions?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 06:11 AM - edited 11-16-2023 06:17 AM
Here i have taken example of incident table.
It has Configuration item Reference field. then the table contains a Owned by field, which refers to sys_user table where the Mail field is present.
Check the below script to find mail .
var grCmdbInc = new GlideRecord('incident');
grCmdbInc.addEncodedQuery('cmdb_ciISNOTEMPTY^active=true^sys_id='+recordsysId);
grCmdbInc.query();
while (grCmdbInc.next()){
if(grCmdbInc.cmdb_ci.owned_by&&grCmdbInc.cmdb_ci.owned_by.email){
gs.info(grCmdbInc.cmdb_ci.owned_by.email);
}
}
Make the changes as per your requirement and you should be able to get the data.
Just to point out, in your script, in while loop, you have written gr.next(), instead of grCmdb.next()
Please mark as correct if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 08:32 AM
Check this article https://developer.servicenow.com/dev.do#!/learn/learning-plans/tokyo/servicenow_administrator/app_st...
In condition field, it will evaluate for the condition to send the mail, so this field will only return true/false. nothing else. Is that the same purpose you are using the script?
By recordsysid, i meant sysid of a specific record, for testing purpose.
What exactly you want to achieve from that script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 02:17 PM
Check the article below. In gs.eventqueue method, in the parameters you can pass the recipient as one of the parameters. So this should solve your issue.
It'll be like, gs.eventQueue('eventname',current,holderName);
You are already getting the holderName from the previous script that I had shared. So you should be good to go.
Please mark as helpful if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 02:17 PM
Check the article below. In gs.eventqueue method, in the parameters you can pass the recipient as one of the parameters. So this should solve your issue.
It'll be like, gs.eventQueue('eventname',current,holderName);
You are already getting the holderName from the previous script that I had shared. So you should be good to go.
Please mark as helpful if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 04:26 AM
Hi @Dibyaratnam , how are you?!
I'm very happy because it's working!!!
I studied the link you shared with me and saw that in the "Who Will Receive" Section itself, there is a the dot walk option in "User/Groups in Fields", just access the field and select "plus".
And in the BR "Advanced" section it is necessary to pass 2 more parameters which are: current, current.<reference field name>
Thank you for your attention, dedication and professionalism.
See you soon and have a great day!
😃
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 05:45 AM
I am glad it worked @Elton2 . Happy Learning✌️. You too have a great day😀