Events not firing for business rule inquiry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 03:08 PM - edited 04-04-2024 03:52 PM
Hello,
I am trying to accomplish the following: After closure of an initial catalog task for a submitted catalog item, I want to initiate an event for three subsequent catalog tasks that are created. The event initiates an email notification that sends a calendar invite for all three catalog tasks which have different start and end times and potentially different "assigned to" individuals that should receive the invite.
My problem: I have a single business rule that checks when these catalog tasks are created. However, the customized event only fires for one of the three catalog tasks. The business rule runs three times, once for each catalog task but the custom calendar invite event is only fired once. I have run the Business Rule debugging and printed information to the system log to confirm the business rule runs for each catalog task that is created. I have been unable to find why the event only fires once, however. I have looked through the ServiceNow Events documentation here but I think I lack a fundamental understanding of how events work. Breaking these up into three separate Business Rules has the same effect, too. All three will run, but the events after the first are never initiated/created.
Why would the event only be triggered for the first catalog task created? Is it because the three are created at almost the exact same time and the eventQueue function operates in such a way the next two events that should be initiated for the other two catalog tasks don't end up in a "queue"? Do I need to be utilizing the "Queue" field for the event to have a higher degree of control of how the events are processed?
Is there a better way to implement this? I see that the "Create Event" option is available in Workflows. That would be very convenient to utilize, but I am not sure how to utilize that option in Workflows for the associated catalog tasks as "current" and "task" do not appear to work for the catalog tasks created. "Current" is, to my knowledge, referencing the requested item and thus I can't use it for initiating the custom catalog task event. And if I attempt to use "task", an error displays in the system logs about it not being a valid reference.
Does anyone have recommendations on the best way to implement this?
EDIT: Actually, after investigating this further I see that most of the time the start and end times were being set incorrectly. It was sheer luck that the one time I disabled it for one of the catalog tasks the second's start and end time were correct. After correcting the script that sets these times, I do not have an issue.
^So, anyone that wants to chime in can ignore essentially everything except, is there a better way to implement this than a Business Rule that runs off the catalog task table? Creating a script step in the workflow that queries these catalog tasks to initiate the events is possible but seems inefficient.