Discussion
NIIT Technologies Limited
AU
Last activity: 22 Sep 2015 8:18 EDT
Multithreading in IAC gadget
Is multithreading supported in IAC?
My requirement:
1) IAC gadget will be used to create a work item (let's say 'BaseWorkItem')
2) This work item's screen will have a menu bar with options to create other work items.(say 'Create work1', 'create work2')
3) After I create work1 and process the assignment, I want to go back to BaseWork item to create work2.
Approaches I tried:
1) Use activity to create work item and use OpenWorkByHandle to open it.
It creates work1 but replaces the thread of BaseWork item, so I cannot go back to launch Work2
2) Use activity to create work item and then use RedirectAndRun to open it which will create new thread.
This creates work1 in new thread and I can come back to base work item to create work2.
But the issue here is it doesn't load all the details of the work item(like open assignments when review harnes is shown).
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
NIIT Technologies Limited
AU
Thank you David.
I have fixed this using multiple gadgets which uses different pega threads.
Accenture
AE
Hi Ravi
Can you share the method of invoking the multiple gadgets or on the below scenerio.
I am loading a interaction by using CreateNewwork..Its creating the WO and showing in the screen when launching the UI. But we have another link inside it that also creates new work Object. when i click on it Its not loading correctly and replacing the current page as self is given. The params are not getting passed....
When we use the OpenbyURL method we are able to load the customer in subsequent tabs but when we toggle between them the tabs are refreshing.
NIIT Technologies Limited
AU
1) Suppose you are using 'FirstGadget' to Create a work item. Attach a custom event 'createNewWO' as shown below.
<div id="FirstGadget"
style="overflow:auto"
PegaGadget="FirstGadget"
PegaThread="FirstGadgetThread"
.
.
.
.
PegaE_onCustom="createNewWO"
PegaA_params={UserIdentifier:"username",Password:"UGcmQyMDE1"}
>
</div>
2) Create second gadget to launch new work item from the link. PegaThread should be different. PegaDefer should be set to true.
<div id="SecondGadget"
style="overflow:auto"
PegaGadget="SecondGadget"
PegaThread="SecondGadgetThread"
PegaPopupOptions = "resizable=yes,scrollbars=yes"
.
.
.
.
1) Suppose you are using 'FirstGadget' to Create a work item. Attach a custom event 'createNewWO' as shown below.
<div id="FirstGadget"
style="overflow:auto"
PegaGadget="FirstGadget"
PegaThread="FirstGadgetThread"
.
.
.
.
PegaE_onCustom="createNewWO"
PegaA_params={UserIdentifier:"username",Password:"UGcmQyMDE1"}
>
</div>
2) Create second gadget to launch new work item from the link. PegaThread should be different. PegaDefer should be set to true.
<div id="SecondGadget"
style="overflow:auto"
PegaGadget="SecondGadget"
PegaThread="SecondGadgetThread"
PegaPopupOptions = "resizable=yes,scrollbars=yes"
.
.
.
.
PegaDefer="true"
>
3) On click of link in the first work object, run a script like -
function newWO()
{
var params = "";
pega.desktop.gadgetCustomEvent(params);
}
4) This desktop API will look for the custom event function attached with gadget.
5) So in gadget HTML, under <script> add javascript function to load second gadget.
function createNewWO(gadgetName, strToken){
pega.web.api.doAction("SecondGadget","load");
}
Accenture
AE
Thanks Ravi..
I have tried this approach but it didnt work may be i didnt properly invoke the gadget and pass the params correctly...
So in the var params = ""; we have the set the params that have to pass.
and then in the Gadget script i have to include the script
function createNewWO(gadgetName, strToken){
pega.web.api.doAction("SecondGadget","load");
}
----------------------------------
Thanks Ravi..
I have tried this approach but it didnt work may be i didnt properly invoke the gadget and pass the params correctly...
So in the var params = ""; we have the set the params that have to pass.
and then in the Gadget script i have to include the script
function createNewWO(gadgetName, strToken){
pega.web.api.doAction("SecondGadget","load");
}
----------------------------------
<div id="PegaGadgetA"
style="overflow: auto;width:100% !important;height:100% !important;"
PegaGadget= "PWGadgetA"
PegaResize="stretch"
PegaA="createNewWork"
PegaA_className="Prjct-FW-B2BFW-Work-ActionDriver"
PegaA_flowName="NBAAActionDriver"
PegaTargetType="_self" PegaDefer="false"
PegaA_params={UserIdentifier:agentId,ctn:ctnmsisdnid,channellId:channelID,CustomerId:ctnmsisdnid}
PegaThread = "OpenPortal"
PegaE_OnLoad ="window.scrollTo(0,0)">
<!--
<script>
var PWGadgetA = {
actionDefinitions:
[
{
action: "createNewWork",
target: {
type: "_gadget",
name: "PWGadgetB"
}
}
]
};
</script>
-->
<script>
function NewWO(PWGadgetA, strToken){
pega.web.api.doAction("PWGadgetB","load");
}
</script>
</div>
<div id="PegaGadgetB"
style="overflow:auto"
PegaGadget="PWGadgetB"
PegaA="createNewWork"
PegaA_className="Prjct-FW-B2BFW-Work-ActionDriver"
PegaA_flowName="NBAAActionDriver"
PegaThread = "ThreadB"
PegaDefer="true"
PegaA_params={UserIdentifier:agentId,ctn:ctnmsisdnid,channellId:channelID,CustomerId:ctnmsisdnid}
PegaAppName = "B2B"
>
</div>
</body>
</html>
-------------------------------
This is the code i have used.
Main Problem:
When we use the Open by URL we are loading directly the Portal and there the agent can have multiple WO(And on click of link we are calling createnewwork).But when the agent opens in subsequent Tabs its getting refreshed when toggling between them(e.g. Open the Dev URLS in susbsequent Tab--same session).. To avoid it we have use Log Off but it was creating many other issues(UI related--Connection Failed etc)
So either we wanted to use openbyURL by forcing new session in each tab...OR use createNewWork to laod WO bcoz by using this method its not refreshing when toggling between subsequent tab...
As we have to opne multiple WO we are trying to pass Params...
The same Method is working When using "_Popup" not when using "_self".
It would be heplful if you suggest any solution or correct the above code.
Thanks in advance :)
NIIT Technologies Limited
AU
Hi Mohith,
Please find my comments below.
However, I didn't understand your complete code.
So in the var params = ""; we have the set the params that have to pass.
Values you are setting in params should be javascript variables. Gadget can consume javascript variables using PegaE_onPageData action. You have to pass each value separately.
For example -
var channelID;
var customerID;
function dataFromPage(token){
if(token == "channelID"){
return channelID;
} else if(token == "customerID"){
return customerID;
}
}
You can refer this function in gadget as -
<
.
.
PegaA_channelID=[page/function/channelID]
Hi Mohith,
Please find my comments below.
However, I didn't understand your complete code.
So in the var params = ""; we have the set the params that have to pass.
Values you are setting in params should be javascript variables. Gadget can consume javascript variables using PegaE_onPageData action. You have to pass each value separately.
For example -
var channelID;
var customerID;
function dataFromPage(token){
if(token == "channelID"){
return channelID;
} else if(token == "customerID"){
return customerID;
}
}
You can refer this function in gadget as -
<
.
.
PegaA_channelID=[page/function/channelID]
PegaA_customerID=[page/function/customerID]
PegaE_onPageData = "dataFromPage"
>
function createNewWO(gadgetName, strToken){
pega.web.api.doAction("SecondGadget","load");
}
Gadget with the name "SecondGadget" is not present in your HTML.
----------------------------------
<div id="PegaGadgetA"
style="overflow: auto;width:100% !important;height:100% !important;"
PegaGadget= "PWGadgetA"
PegaResize="stretch"
PegaA="createNewWork"
PegaA_className="Prjct-FW-B2BFW-Work-ActionDriver"
PegaA_flowName="NBAAActionDriver"
PegaTargetType="_self" PegaDefer="false"
PegaA_params={UserIdentifier:agentId,ctn:ctnmsisdnid,channellId:channelID,CustomerId:ctnmsisdnid}
PegaThread = "OpenPortal"
PegaE_OnLoad ="window.scrollTo(0,0)">
Custom event should be attached to gadget using PegaE_onCustom
Main Problem:
When we use the Open by URL we are loading directly the Portal and there the agent can have multiple WO(And on click of link we are calling createnewwork).But when the agent opens in subsequent Tabs its getting refreshed when toggling between them(e.g. Open the Dev URLS in susbsequent Tab--same session).. To avoid it we have use Log Off but it was creating many other issues(UI related--Connection Failed etc)
So either we wanted to use openbyURL by forcing new session in each tab...OR use createNewWork to laod WO bcoz by using this method its not refreshing when toggling between subsequent tab...
As we have to opne multiple WO we are trying to pass Params...
The same Method is working When using "_Popup" not when using "_self".
I don't think I understand your issue. But IAC caches most of the things in session including authentication information. So you have to logout before jumping to another gadget if it is in different session. In one of the implementation, I am using below code to toggle between gadgets, but we are not using tabs.
function closeSession(gadgetName, harnessName, className, paramObject, configObject){
pega.web.api.doAction(gadgetName,"LogOff",harnessName,className,paramObject,configObject);
}
function displayResearchGadget(gadgetName, strToken){
un = strToken;
closeSession("Gadget1","Gadget1Harness","XXX-XXX-XX-Work-Interaction- WebGadget","Gadget1","");
closeSession("Gadget2","","","Gadget2","");
pega.web.api.doAction("Gadget2","load");
document.getElementById("Gadget1").style.display = "none";
}
NIIT Technologies Limited
AU
Also, make sure your HTML file is deployed in App server and you are not running it standalone for gadget events to work.
Accenture
AE
Due to timelines we are loading the second interaction(in case if agent wants to see detials of other WO(optional)) in the same gadget. We have used different threads for the different interactions, using "CreateNewWork" Method we are launching the WO directly in the Portal.
I will try this method and let you know the outcome. Thanks a lot :)