Where pega.desktop.createNewWork() function is used?


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?




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);



Ravi Kumar.

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.


Keep up to date on this post and subscribe to comments

December 11, 2015 - 6:36pm

Hi Ravi,

Yes, it is used to create new work by passing argument.

Which PRPC version you are making use of?

December 11, 2015 - 6:43pm

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.

December 13, 2015 - 2:15pm

Any sample code for creating the WO using this function in V62?

December 21, 2015 - 11:13am

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" />


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 : &param1=value1&param2=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.


function buttonFunc(){

var safeURL = new SafeURL();











<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.

February 4, 2016 - 12:20am
Response to shret

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


function startUpdateFlow()


  createNewWork("ClassName", "","FlowName", "&Param1=1234567890&Param2=true");



<button type="button" onclick="startUpdateFlow()"> test update flow </button>

solution tried 2:


function startUpdateFlow(){

var safeURL = new SafeURL();


safeURL.put("flowType","flow name");







Could you please tell me whether this will work if i use tabs approach?

November 29, 2016 - 3:51am
Response to shret

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.

November 29, 2016 - 3:54am
Response to amolt885

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! 

I'm using the below code in non auto generated HTML but it opens the new work in new window and not inside the portal

Lochan  |  Community Moderator  |  Pegasystems Inc.



Lochana | Community Moderator | Pegasystems Inc.

November 30, 2016 - 2:58am

this createNewWork function opens the flow in new window instead of opening in a Portal. Any suggestions ?