
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2018 07:27 AM
I am sending an email notification to a single user about an incident being assigned to their group. In the email notification, I am looking to include a link that will allow the user to click on it and have the specified incident assigned to them.
I have read that I might be able to use Processors for this requirement, but I am not at all familiar with creating/using processors. Any help is much appreciated!
Thanks,
Chris
Regards,
Chris Perry
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2018 10:54 AM
I got this to work on my PDI
HTML
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g2:evaluate var="jvar_unwrapped_url" jelly="true">
var currentUser = gs.getUserID();
var incidentFromURL = RP.getParameterValue('incident');
var link = '';
var incident = new GlideRecord('incident');
if(incident.get('number', incidentFromURL)) {
incident.setValue('assigned_to', currentUser);
incident.update();
gs.addInfoMessage(incident.getDisplayValue() + ' has been updated.');
//gs.sendRedirect(incident.getLink());
link = incident.getLink();
}
link || 'incident.do?sysparm_query=number=' + incidentFromURL;
</g2:evaluate>
${gs.getMessage("Redirecting to your the incident")}...
</j:jelly>
Client Script
document.location.href = "$[JS:jvar_unwrapped_url]";
Link to the page with a url like /i.do?incident=INC12345

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2018 07:34 AM
Might be easier to just use a generic UI page with a url param for the record number or sys_id, then in the server script, do an update to the record to the logged in user, then gs.redirect to the record itself.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2018 07:44 AM
Thanks for your response, Jace. Could you be a little more specific?
I also do not have a ton of experience with UI pages - how are you suggesting to implement that into the email notification, and what kind of setup are you recommending for the generic UI page?
Thanks so much,
Chris
Regards,
Chris Perry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2018 10:29 AM
Hi Jace,
I set up a UI page that is working to assign the specified incident to the logged in user and redirect to the incident when the 'OK' button is clicked in the HTML portion.
Do you know of a way where the processing script in the UI page could be executed without having to submit the UI page by clicking 'OK' from the HTML piece? Essentially I just want the user to be able to click the link, and automatically assign them to the incident record and redirect to the record. Here is what I have so far:
Thanks again for your help!
Regards,
Chris Perry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2018 10:52 AM
In the HTML you could just add a <g:evaluate>/* code to do the update here*/</g:evaluate> and that will execute when the page loads server side. Meaning it will update the code;
So I'd try this;
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate>
var user = gs.getUserID();
var incidentFromURL = RP.getParameterValue('incident');
var link = '';
//expects url of /uipage.do?incident=INC12345
var incident = new GlideRecord('incident');
if(incident.get('number', incidentFromURL)){
incident.setValue('assigned_to', user);
incident.update();
link = incident.getLink();
}
gs.redirect(link);
</g:evaluate>
</j:jelly>
Then you'd just have to make your email follow the link with the proper parameter.