Create a notification if Additional Comment is made by non-itil users on RITM tickets via portal

jeffreygard1127
Tera Contributor

Good day everyone!

 

I need help with my task.

 

Our Non-ITIL users do not have access to post Additional Comments on all SCTASK tickets from the portal view. They can only post Additional Comments on the RITM tickets but not on the SCTASK tickets.

I need help in creating notification for the following scenario:

 

1.) SCTASK ticket associated to RITM ticket is still UNASSIGNED - If the user on the "Requested For" field is NON-ITIL and they posted an Additional Comment on the RITM, there should a notification that will be sent to the Assignment Group indicated on the SCTASK ticket that the user posted an Additional Comment on the RITM ticket. 

 

2.) SCTASK ticket associated to RITM ticket is ASSIGNED - If the user on the "Requested For" field is NON-ITIL and they posted an Additional Comment on the RITM, there should a notification that will be sent to the ASSIGNED TO indicated on the SCTASK ticket that the user posted an Additional Comment on the RITM ticket. 

1 REPLY 1

Slava Savitsky
Giga Sage

Here is how you can approach it:

 

1. Navigate to the event registry and register a custom event there. For example:

 

 

sc_req_item.updated_by_non_it_requestor

 

 

 

2. Create an "after update" business rule for the Requested Item [sc_req_item] table with a condition to react to updates of Additional Comments made by the Requested For person if they don't have the ITIL role, which could be something like this:

 

 

current.comments.changes() && gs.getUserID() == current.requested_for && !gs.hasRole('itil')

 

 

 

3. In the code of that business rule, use GlideRecord API to get a list of SCTASKs of that RITM. Then loop though the list of SCTASKs and fire your custom event for each of them using gs.eventQueue() method. For reference, you can either use one the base system business rules (e.g., "sc req item events") or check out the API documentation.

 

4. Finally, create two notifications for Catalog Task [sc_task] table that would react to your custom event (Send when = "Event is fired"; Event name = "Your custom event name"). One of them would have the condition "Assigned to is not empty" and the other one "Assigned to is empty AND Assignment Group is not empty", so that they never get sent out together. If you want both notifications to have the same content, you can create an email template and have both notifications use that template.