Need help with "sc req item events" Business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2011 12:44 PM
We need the "sc_req_item.inserted" event to also fire if the "Request.Requested_For", changes. So, we need it to fire when the Item is requested, like it does now but we also need it to fire if the request.requested_for changes to someone else, so they can also receive the notification. I tried changing the below Business Rule but ended up receiving duplicate notifications when the Item was opened.
if (current.operation() != 'insert' && current.comments.changes()) {
gs.eventQueue("sc_req_item.commented", current, gs.getUserID(), gs.getUserName());
}
if (current.operation() == 'insert') {
gs.eventQueue("sc_req_item.inserted", current, gs.getUserID(), gs.getUserName());
}
if (current.operation() == 'update') {
gs.eventQueue("sc_req_item.updated", current, gs.getUserID(), gs.getUserName());
}
if (current.operation() == 'update' && current.stage == "delivery") {
gs.eventQueue("sc_req_item.delivery", current, gs.getUserID(), gs.getUserName());
}
if (!current.assigned_to.nil() && current.assigned_to.changes()) {
gs.eventQueue("sc_req_item.assigned", current, current.assigned_to.getDisplayValue() , previous.assigned_to.getDisplayValue());
}
if (current.stage.changes()) {
gs.eventQueue("sc_req_item.change.stage", current, current.stage, previous.stage);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2011 01:25 PM
Thank you, I'll give it a try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2011 01:56 PM
I tried it but seem to be having some problems still.
If I use the one below. The first email is firing 3 times.
if (current.operation() == 'insert' || current.request.requested_for.changes()) {
gs.eventQueue("sc_req_item.inserted", current, gs.getUserID(), gs.getUserName());
}
If I use the one below. The first email only fires once but when I change the request.requested_for on the Requested Item, it doesn't fire the email to the new requested for.
if (!current.operation() == 'insert' && current.request.requested_for.changes()) {
gs.eventQueue("sc_req_item.inserted", current, gs.getUserID(), gs.getUserName());
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2011 02:03 PM
I messed up the syntax when I originally wrote that. For the second one, try:
if (current.operation() != 'insert' && current.request.requested_for.changes()) {
gs.eventQueue("sc_req_item.inserted", current, gs.getUserID(), gs.getUserName());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2011 06:03 AM
Hey, I tried again just using the below and it fires two emails. Any suggestions?
if (current.operation() != 'insert' && current.request.requested_for.changes()) {
gs.eventQueue("sc_req_item.inserted", current, gs.getUserID(), gs.getUserName());
}