Discussion
Capgemini
IN
Last activity: 23 May 2016 23:11 EDT
Get active thread from Requestor
Hi,
Wanted to know if there is any API function to get the current thread from requestor.
We are putting one icon at the header of the portal but in the work panel if user opens 2,3 threads how can we get the latest thread or active thread through API call on icon action.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
u can write java step and use tools.getThread() api to get the thread object
PRThread threadName = tools.getThread();
threadName.getName(); give you the current thread Name
Capgemini
IN
thanks for response.
will try and update if we face any issue.
Capgemini
IN
Hi,
Its workking if i put html inside workpanel (work-object level harness), but not working from header.
Any other way to achieve the same?
Pegasystems Inc.
US
where the header is refered ?
Capgemini
IN
Let me explain you the issue here,
We have one composite portal in which we are refferering a harness rule which contains header (top panel) and work area (center panel).
Our requirement is to get the thread id & details from work area panel whenever user clicks on icon which is present on header.
Your suggestion is only working if i put html/js code inside work area panel, not from header.
Capgemini
IN
Pegasystems Inc.
US
the code didnt work because header (top panel) always run in the Open Portal or Standard Thread context. You can trace the stream rules to find under which hread context the header is rendering
Capgemini
IN
Yes. its running on OpenPortal thread.
Capgemini
IN
Any chance we can achieve this in P7?
Pegasystems Inc.
US
The other option you can try is get the current thread name from pxThreadPage and use the below code
String threadname = tools.findPage("pxThread").getString("pxThreadName");
PRThread myCurrentthread = tools.getThread().getRequestor().getThread(threadName);
Capgemini
IN
No luck .. its always returning "OpenPortal"
just added below line after ur code.
---------------------------------------
String threadname = tools.findPage("pxThread").getString("pxThreadName");
PRThread myCurrentthread = tools.getThread().getRequestor().getThread(threadName);
---------------------------------------
String myCurrentthreadname = myCurrentthread.getName();
alert(myCurrentthreadname); //output "OpenPortal"
also didnt understand 2nd line of your code, what does it do?
Pegasystems Inc.
US
it gets the current state of thread and you can access the clipboard data using that thread information
Capgemini
IN
thanks, but its always returning "OpenPortal" .(default threadID from header panel)
American Express
US
I do not know the solution but i assume you have already discussed with the business that the icon placement is not correct.
If you make this work they might come back to you asking to put where am i, attachments, audit trail icons etc also at the same place.
Ideally Icons which pull details to a specific case should be at work level only.
Thanks
Chiranjeevi
Cognizant
US
If you are on Pega 7 you can try this to get the Active thread ..
------------------------------------------------------------------------------------------------
PublicAPI tools = null;
PRThread thisThread = (PRThread)ThreadContainer.get();
if (thisThread != null)
{
tools = thisThread.getPublicAPI();
}
if (tools == null)
{
throw new com.pega.pegarules.pub.PRRuntimeError("Can't get a PublicAPI reference.");
}
try {
String portalName = tools.findPage("pxThread").getString("pxPortal");
ClipboardProperty dynamicContainerActiveThreadID = tools.getIfPresent("Declare_pyDisplay.pyDisplay("+portalName.trim()+").pyUIActive(1).pyThreadId");
if (dynamicContainerActiveThreadID != null) {
String threadId = dynamicContainerActiveThreadID.getStringValue();
if(!"".equals(threadId)) {
return threadId;
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return "STANDARD";
------------------------------------------
Capgemini
IN
but our concern is that if we put icon on work level that will require huge amount of change in whole application, as there are multiple UI which we need to modify to achieve this.
Updated: 23 May 2016 23:11 EDT
CSC Information Technology Phils
PH
Try to read this link, it might help
https://pdn.pega.com/forums/general-questions/sharing-information-between-prpc-threads