- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2016 07:50 AM
Hi,
I have a requirement when an Incident is logged via email to generate a number of Fields. The ticket will be already logged at this stage and going by the Short Description it should populate the relevant fields (like an auto populating template). I tried this with a Client Script (below). The client script does work but not for my use, as the Incident is already logged it does not generate the fields.
Does anyone have any ideas on either making any changes to the client script or a totally better way of doing this?
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var svc= g_form.getValue("short_description");
if (svc == "RE: Blocked Attachment Notification") {
g_form.setValue("u_security_sub_state", "Test");
g_form.setValue("priority", "P3 (3 day fix)");
g_form.setValue("cmdb_ci", "MessageLabs");
}
}
Thanks,
Riaz
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2016 08:05 AM
On onChange Client Script is the wrong approach, as it relies on someone visiting the record and changing the short description to the text in your code. Of course, if this is your business process, then it would work. But from your post, I gather the email comes in with that short description, and the incident is made with it already set.
You either need to hit this from the Inbound Email Action or on a Business Rule (on insert/update).
A body of a business rule would look similar to this:
if (current.short_description == "") {
current.priority = "P3 (3 day fix");
current.u_security_sub_state = "Test";
current.cmdb_ci.setDisplayValue("MessageLabs");
}
Make sure that one is set to run "onBefore" and on Insert.
If you're editing the OOB Inbound Email action for creating an incident, you'd place the same code into the action, just after the action is setting the short_description of the incident from the email.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2016 08:05 AM
On onChange Client Script is the wrong approach, as it relies on someone visiting the record and changing the short description to the text in your code. Of course, if this is your business process, then it would work. But from your post, I gather the email comes in with that short description, and the incident is made with it already set.
You either need to hit this from the Inbound Email Action or on a Business Rule (on insert/update).
A body of a business rule would look similar to this:
if (current.short_description == "") {
current.priority = "P3 (3 day fix");
current.u_security_sub_state = "Test";
current.cmdb_ci.setDisplayValue("MessageLabs");
}
Make sure that one is set to run "onBefore" and on Insert.
If you're editing the OOB Inbound Email action for creating an incident, you'd place the same code into the action, just after the action is setting the short_description of the incident from the email.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2016 08:26 AM
Thanks - I added a business rule on Insert and works great
Riaz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2016 08:11 AM
Hi,
Since incident is created from email,
Update OOB inbound email action based on your requirement. Inbound email action acts like a server side script. So you have to use the concept of business rule.