- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2023 03:08 AM
Hi all
eventQueue(String name, Object glideRecord, String parm1, String parm2, String queue)
can you please any one help me with some simple scenario if it is possible.
Thanks
Jyothinath
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2023 05:26 AM
Hi Jyothinatha,
There are two ways to generate events:
- Server-side script using the gs.eventQueue() method
- Workflow Create Event activity
gs.eventQueue() Method
The eventQueue() method is part of the GlideSystem server-side API. The eventQueue() method inserts an event in an event queue. The eventQueue() method is typically passed four parameters but can also take an optional 5th parameter:
- Event name. Enclose the event name in quotes.
- GlideRecord object, typically current but can be any GlideRecord object from the event's table.
- Any value that resolves to a string. This is known as parm1 (Parameter 1). Can be a string, variable that resolves to a string, or method that resolves to a string.
- Any value that resolves to a string. This is known as parm2 (Parameter 2). Can be a string, variable that resolves to a string, or method that resolves to a string.
- (Optional) Name of the queue to manage the event.
example:
gs.eventQueue('event.name', GlideRecord, parm1, parm2); // standard form
gs.eventQueue('x_58872_needit.overdueNeedItTask',current,current.number,gs.getUserName());
eventQueue(String name, Object glideRecord, String parm1, String parm2, String queue)
Parameter(s):
name | String | Name of the event being queued. |
glideRecord | Object | GlideRecord object, such as "current". |
parm1 | String | (Optional) Saved with the instance if specified. |
parm2 | String | (Optional) Saved with the instance if specified. |
queue | String | Name of the queue. |
The first parameter is the event name and this is defined in the event-> Registry.
Please mark your response as helpful or correct.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2023 05:03 AM - edited 05-14-2023 05:07 AM
Hi there.
Here are a couple of scenarios: - the code writes to the Event table and event (e.g. incident.commented, incident.assigned). Parm1 and Parm2 can include extra data about the event (e.g. sysid of the assignee, incident caller sysid)
(i) Logging - There is a business rule baseline called "incident events". The business rule runs after a change has occurred and writes that change data to the Events table (e.g. work_notes updated, state change...).
(ii) Events can be used as triggers for Notifications. So for example, the event incident.assigned can be used to trigger a Notification to the assignee.
(iii) Script Actions are triggered by Events. So you might want the Script Action to trigger when an Incident is created (e.g. incident.inserted) and fire a integration, subflow or some other business logic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2023 05:26 AM
Hi Jyothinatha,
There are two ways to generate events:
- Server-side script using the gs.eventQueue() method
- Workflow Create Event activity
gs.eventQueue() Method
The eventQueue() method is part of the GlideSystem server-side API. The eventQueue() method inserts an event in an event queue. The eventQueue() method is typically passed four parameters but can also take an optional 5th parameter:
- Event name. Enclose the event name in quotes.
- GlideRecord object, typically current but can be any GlideRecord object from the event's table.
- Any value that resolves to a string. This is known as parm1 (Parameter 1). Can be a string, variable that resolves to a string, or method that resolves to a string.
- Any value that resolves to a string. This is known as parm2 (Parameter 2). Can be a string, variable that resolves to a string, or method that resolves to a string.
- (Optional) Name of the queue to manage the event.
example:
gs.eventQueue('event.name', GlideRecord, parm1, parm2); // standard form
gs.eventQueue('x_58872_needit.overdueNeedItTask',current,current.number,gs.getUserName());
eventQueue(String name, Object glideRecord, String parm1, String parm2, String queue)
Parameter(s):
name | String | Name of the event being queued. |
glideRecord | Object | GlideRecord object, such as "current". |
parm1 | String | (Optional) Saved with the instance if specified. |
parm2 | String | (Optional) Saved with the instance if specified. |
queue | String | Name of the queue. |
The first parameter is the event name and this is defined in the event-> Registry.
Please mark your response as helpful or correct.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2023 08:29 AM
Really Thanks For The Information K Akhila.