Triggering custom Event from Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2020 10:43 AM
Hello,
I'm trying to trigger a custom event from a specific workflow, but am having troulble.
My catalog item "Employee Onboarding" triggers a workflow called "Employee Onboarding".
The first step in the workflow is a group approval for the HR Dept.
I want to send a custom email approval notification to this group from the sysapproval_approver table, not the OOB one.
I have created a Notification called "Approval RITM for Onboarding".
This notification refers to an event I created in the Registry called "Employee_Onboarding_Approval".
The issue is, I don't know how to trigger this event from my onboarding workflow approval step.
I'm assuming I need to use a script in the "Advanced" box, but don't know exactly what it should say.
Here's what I have so far: gs.eventQueue('Employee_Onboarding_Approval',current,gs.getUserName(),gs.getUserID());
Help!
- Labels:
-
Request Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2020 06:44 AM
So if you do not want that, comment that triggering of event or change that event triggering of event to your event name.
Also i see that the notificaiton is on sysapproval_approver. Is yoru workflow also on sysapproval_approver. If not, then in the eventQueue function, you need to pass the object of sysapproval_approver and not current.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2020 09:36 AM
Here are some excerpts from my business rule:
function checkSCRitm() {
var task = current.sysapproval.sys_class_name || current.source_table;
return (task == 'sc_req_item');
}
var isSCRitm = checkSCRitm();
if (current.state.changes() && current.state=='requested') {
var event = "approval.inserted";
if (isSCRitm)
event = "Employee_Onboarding_Approval";
//else if (isSCRitm)
//event = "ritm_approval";
}
This triggers the event I want.
However you see I had to comment out the general "ritm_approval" which I still need for other requested items.
How can I specify one event for "Employee_Onboarding_Approval"
and another one for just "ritm_approval" for everything else?
The Catalog item name is "Employee_Onboarding".

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2020 10:31 AM
Before triggering the event, fetch the appropriate record from the table, and pass that Gliderecord object as a parameter to the event.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2020 12:36 PM
I just tweaked your code slightly. Check once.
function checkSCRitm() {
var task = current.sysapproval.sys_class_name || current.source_table;
return (task == 'sc_req_item');
}
var isSCRitm = checkSCRitm();
if (current.state.changes() && current.state=='requested') {
var event = "approval.inserted";
if (isSCRitm) {
if(current.group!='') {
event = "Employee_Onboarding_Approval";
} else {
event = "ritm_approval";
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2020 01:18 PM
Well, this sort of works.
It triggers the "Employee_Onboarding_Approval" event for any Group Approval step in any workflow. Unfortunately, I need it to run only on this specific workflow.