Question
Highmark
US
Last activity: 5 Oct 2018 14:13 EDT
How to identify invoking source/activity
Hi I have an activity, its being called from so many places/sources(activities, UI on change etc..)
Now I need to know from where this activity was invoked. (Mainly class name and Rule name)
Below is code snippet which is working fine, if this was called from activity. I am looking for any other better options.
PRStackFrame pRSF=tools.getStackFrame().getPrevious(); //is the current step holder
//Identifiying the previous activity step which is call of this activity.
while(pRSF!=null){
pRSF=pRSF.getPrevious();
if(pRSF!=null && pRSF.getType().toString().equals("ACTIVITY_STEP")){
break;
}
}
if(pRSF!=null){
tools.putParamValue("FinalValue",pRSF.getLabelVariable(0));
}
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
CollabPartnerz
IN
could you please explain a bit clear.
Highmark
US
Lets say, I have a an activity which can post information to downstream application by calling a stored procedure.
This activity has to send work item snapshot in everty transaction.
Examples: sla agent changes urgency, workitem is reassigned, workitem is resolved. suspeneded, etc..
so in all the above places we are calling that posttodownstreamactivity. so it has somany references. some times its failing. so we wanted to log the failure and wanted to know in which path its failing.
so in runtime we need to know the calling activity of this. for logging/emailing based on that.
Pegasystems Inc.
IN
You can identify the activity details in the tracer , set the tracer settings to track the activity
-
Suebwong Kasemsawasdi
Highmark
US
I need to know in run time, not on tracing it.
something like I need to send an email to different dls, based on from where its called. if my activity is invoked from a, I need to send email to Proprietary information hidden
if its invoked from b, I need to sent to Proprietary information hidden
my handling is different based on the context of calling acitivity.
Pegasystems Inc.
IN
Hi Hari,
Thanks for posting on PSC.
Try opening view references from action tab of the rule and see from where all the activity have been referenced.
Thank you
Highmark
US
thank you, I didn't mean to see all the references. I need to know the invoking activity in run time.(not just activity could be UI or any)
-
Georges Haytove
Coforge DPA Aus Pvt Ltd
AU
i tried and its working perfectly fine.
I followed below steps.
Created a function with below java code and property set to param the out come.
Highmark
US
Hi Chiranjeevi, its something simler to my way. I didn't try function. but will move my code to that. thanks for sharing this approach too.
as far as I understand there is no easy way/some context params to identify that. we need to write a piece of code with iteration.