Fetch requested for from user entered in CC when RITM is created from Inbound action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2024 11:04 PM
Hi,
I want to pop up requested for on RITM field with the user entered in CC (there will always be one). The tickets will be created through inbound action. Here is the script i am using not sure what exactly i am doing wrong. I checked with logs, email id is coming fine and user is also present in system but requested for is going blank. please have a look and help me any possible way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2024 11:17 PM
Assuming it will always be only 1 email address in cc, this won't be that hard.
The issue is that you are setting a reference field ('requested_for') to a string value (email address in the copied field). That won't work. You need to query the user table to find the user with that email address and fill the user's sys_id.
var requested_for = '';
var copied = email.copied;
var reqFor = new GlideRecord('sys_user')
reqFor.addQuery('email',copied);
reqFor.query();
if(reqFor.next()){
requested for = reqFor.getUniqueValue;
}
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2024 12:45 AM
Hi Mark,
Thanks for the response. I tried the way you mentioned but requested for is still coming blank on RITM.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2024 01:11 AM
I just noticed a typo in my script, so if you copied it literally, make it 'requested_for = reqFor.getUniqueValue();'
Otherwise: add logs to your script to see what it is your are getting. If it is the sys_id of the user, validate if the field is correct and also check where you are really setting the value on the form. I see you are setting rec.short_description and other fields, but not requested for.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2024 04:25 AM
Hi @Mark Manders
I already corrected the typo before using code. The log i got is bit weird
native code, arity=0]
Please help me if you have any idea.