Question
GovCIO
US
Last activity: 30 Nov 2016 2:58 EST
Where pega.desktop.createNewWork() function is used?
Hi,
Can someone tell me on what is the purpose of pega.desktop.createNewWork() function? Does this use to create a work object from the HTML by passing some params? If yes, what are the implications of using it? If no, where can we use it?
Desktopwrapper.js
/*
@api
Brings up the New Harness for the specified type of object.
@param $String$strClassName - Type of object(work item, cover, covered item).
@param $Integer$harnessVersion - 0 or 1, 0 is heritage (v3) harness, 1 is v4 harness.
@param $String$strFlowName - Name of flow to start for this work object.
@return $void$
*/
function createNewWork(strClassName, harnessVersion, strFlowName) {
return pega.desktop.createNewWork(strClassName, harnessVersion, strFlowName);
}
Thanks,
Ravi Kumar.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
IN
Hi Ravi,
Yes, it is used to create new work by passing argument.
Which PRPC version you are making use of?
GovCIO
US
Thanks Arvind. I am using V62 SP2. Can you please give some more insights of it? If any sample you have, please post it here.
GovCIO
US
Any sample code for creating the WO using this function in V62?
Pegasystems Inc.
IN
Hi Ravi,
I have used the method in PRPC 7.1.6 to launch a flow. Below is the sample :
1. In a non-auto generated section, include a JS file. This JS file would include the API call.
<pega:static type="script" app="webwb" moveToEnd="true"> // this is how we include a JS file
<pega:file name="TempTestFile.js" />
</pega:static>
2. In the TempTestFile.js file have the below code
pega.u.d.attachOnload (function(){pega.desktop.createNewWork("Good-FW-gcsFW-Work", 1, "NewWork")},true);
here in the API pega.desktop.createNewWork(strClassName, harnessVersion, strFlowName, flowParams) :
strClassName - class name
harnessVersion - harness version, set it as 1
strFlowName - flow name
flowParams - if any parameters are passed in the flow, then you can pass it here in the format : ¶m1=value1¶m2=value2
where "&" and "=" are delimiters
There is another way you can use the API call :
In an HTML page(non-auto generated section) you can create a button. When you click the button, a new work item would be created.
<script>
function buttonFunc(){
var safeURL = new SafeURL();
safeURL.put("className",'PegaSample');
safeURL.put("flowType","BUG64630");
safeURL.put("HarnessVersion",'1');
safeURL.put("Param1",'xxx');
safeURL.put("Param2",'yyy');
safeURL.put("Param3",'1234');
Hi Ravi,
I have used the method in PRPC 7.1.6 to launch a flow. Below is the sample :
1. In a non-auto generated section, include a JS file. This JS file would include the API call.
<pega:static type="script" app="webwb" moveToEnd="true"> // this is how we include a JS file
<pega:file name="TempTestFile.js" />
</pega:static>
2. In the TempTestFile.js file have the below code
pega.u.d.attachOnload (function(){pega.desktop.createNewWork("Good-FW-gcsFW-Work", 1, "NewWork")},true);
here in the API pega.desktop.createNewWork(strClassName, harnessVersion, strFlowName, flowParams) :
strClassName - class name
harnessVersion - harness version, set it as 1
strFlowName - flow name
flowParams - if any parameters are passed in the flow, then you can pass it here in the format : ¶m1=value1¶m2=value2
where "&" and "=" are delimiters
There is another way you can use the API call :
In an HTML page(non-auto generated section) you can create a button. When you click the button, a new work item would be created.
<script>
function buttonFunc(){
var safeURL = new SafeURL();
safeURL.put("className",'PegaSample');
safeURL.put("flowType","BUG64630");
safeURL.put("HarnessVersion",'1');
safeURL.put("Param1",'xxx');
safeURL.put("Param2",'yyy');
safeURL.put("Param3",'1234');
safeURL.put("Param4",'k4567z');
pega.desktop.createNewWork(safeURL);
}
</script>
<button class='buttonTdButton' alt='' title='' onclick="buttonFunc();">NEW_WORK_BUTTON</button>
If the above information does not help you, let me know what is your usecase so that we can have the same approach.
Anthem Inc.
US
Hi Shrestha,
I have a requirement where i need to pass the flow params when calling that flow from a button.
I tried using Create Work- action item but it dint work and i tried using control but it dint work too. I am able to create a wo but the params are not getting passed.
note: the work object is getting created in a new tab as we are using tabs.
solutions tried:1
<script>
function startUpdateFlow()
{
createNewWork("ClassName", "","FlowName", "&Param1=1234567890&Param2=true");
}
</script>
<button type="button" onclick="startUpdateFlow()"> test update flow </button>
solution tried 2:
<script>
function startUpdateFlow(){
var safeURL = new SafeURL();
safeURL.put("className",'xx-xx-xx');
safeURL.put("flowType","flow name");
safeURL.put("HarnessVersion",'1');
safeURL.put("param1",'1234567890');
safeURL.put("param2",'true');
pega.desktop.createNewWork(safeURL);
}
</script>
Could you please tell me whether this will work if i use tabs approach?
Virtusa
IN
Hi Shret,
I am using above code in non auto generated HTML but it opens the new work in new window and not inside the portal. I have included my section in pyPortalContent section.
Please advise.
This comment has been branched out as a new node and the new thread can be followed here
Pegasystems Inc.
IN
Hi Amol,
To increase the visibility to your question, we have created a new post for you. Please click on the below hyperlink to get to you post. Please edit the post to add in the details that I could have missed and to add a reply so that the discussion continues there!
Regards,
Lochan | Community Moderator | Pegasystems Inc.
Virtusa
IN
this createNewWork function opens the flow in new window instead of opening in a Portal. Any suggestions ?