How to retrieve the Trigger name in the flow


Is there a way for the process flow to retrieve the name of the trigger or event that started it? For example, suppose the ftp trigger “ABC_Trigger” is tied to process flow “ABC_PF” by event “ABC_Event”. When process flow ABC_PF runs, is there a way for it to set a context variable to the trigger name “ABC_Trigger” or the event name “ABC_Event”?

I will have a fair number of triggers pointing to various ftp sites to pull back files. I would like each of these triggers to start the same master process flow, where the process flow will retrieve the source schema name, the mapping name, and the target name from a database, will retrieve the IDs from the Adeptia database, and will override the items on the master process flow using these values. But if the master process flow can’t detect what trigger started it, I can’t set it up this way. (The file names won’t contain enough information to identify where the file is coming from, so I can’t use the source.)


Using the below code in the custom plugin you can get eventName, eventId from process flow context only if that process flow runs through event.


import java.util.*;

Map eventMap = (Map) context.get("EventContextMap");
String eventName = "N.A.";
String eventId = "N.A.";
if(eventMap != null){
eventName = (String) eventMap.get("EventName");
eventId = (String) eventMap.get("EventID");
context.put("eventName", eventName);
context.put("eventId", eventId);

Similarly, you can use the above plugin for fetching all the values like EventParam, FilePath etc from EventContextMap. Below is the Plugin for fetching the EventParam value from EventContextMap:

import java.util.*;

Map eventMap = (Map) context.get("EventContextMap");
String EventParam;
if(eventMap != null){
EventParam = (String) eventMap.get("EventParam");
context.put("EventParam", EventParam);

Have more questions? Submit a request


Article is closed for comments.