Discussion

Want to Split Work Object and make new IDs

Hi, I've previously written a question about the split option in Pega. From what I've seen, the split will not create a new work object ID. For what I'm doing, I think it will confuse the users to have multiple tasks all associated with the same work object ID #. I would like for the beginning of one work object to spawn multiple objects, each with their own unique ID #. Is there a way to do this? I've yet to see it in my testing. Thx.

***Updated by moderator: Marissa to close 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.

Comments

Keep up to date on this post and subscribe to comments

May 13, 2008 - 2:53am

Hi

If I am correct, you want to create a new work object with the data of previous work object. For this, You can create a activity from with in your flow which will copy your data on a temporary page. Then call activity createWorkProcess on the temporary created page. It will create a new workobject with all the data and new ID.

I hope this helps.

Thnx

May 13, 2008 - 9:48am

Thank you! That's exactly what I want to do!
I'll give it a try and let you know how it goes.

Pega
May 13, 2008 - 12:24pm

createWorkProcess is designed for service calls, so it is not ideal for this usage.

The activity Work-.SpinOffNewWork is a sample activity that we provide for how to spin off a new work object from a utility activity. If you want to spin off covered objects from a cover using a utility shape, check out Work-Cover.CreateCoveredObject.

May 14, 2008 - 6:24pm

Thanks for the responses.

I've tried what you said so far and so far so good, but I need to know the best way to get each page of the pagelist to be the primary page of the newly spawned work object.

From what I've seen so far, I'm not getting the data to come over to the new work object.

Thanks for everything so far, if you know how to do this, I would really appreciate it.

May 15, 2008 - 7:35am

One possible solution could be :
Save the SpinOffNewWork activity in your own ruleset with a new name. Add step for copying the data from the workpage in this activity. This could be tricky as primary page will not be pyWorkPage here. Keep other steps as they are.

Create a new activity, run a loop on each page of the Pagelist property, call the activity you just saved above. pass the classname and model name to it.

It should create individual work objects.

Let us know, how it goes.

May 16, 2008 - 5:50pm

Hey,
I didn't forget to let you know how it went.
I finally got to get more completed and tested.
I'm proud to report, I was able to copy data from the parent WO# to the child WO#.

I was able to save the rule "Work-.SpinOffNewWork" in the embedded class used for looping.

I added a row in the activity prior to the "AddWork" method step and saved the pagelist page with a "Page-Copy" method, by saving it to the already declared "SpunoffWork" page.

The new work object contained the data, just as I needed.

Of course, the users have come back and thrown a monkeywrench into being done, but this was a big step to get this to work and it does now.

Eventually, I'm going to tweak it so that it will save off multiples, when the page is of values that I put in a map, because some choices shouldn't be separated.

More details than needed, but suffice it to the fact this hurdle has been jumped and it's on to the next one.

Thanks to all that gave ideas on how to do this!

May 22, 2008 - 10:21am

Hey all,
I did get this working. I now have one work object create multiple work objects, one for every entry in a particular page list and copying that page list data over to the new work object created.

The big exception is that some page list entries need to be combined together into one work object. So, a map value table is used to determine which values should be on the same work object.

I've tested it and it works wonderfully. Plus, all I have to do in the future to maintain this list if the user's want to change it is update this map value table. No "hard coding" used.

Thanks again for all that helped!

Pega
May 22, 2008 - 10:25am

Glad to hear it's all working.

February 29, 2012 - 5:21pm

I have different issue using SpinOffNewWork

I am able to pass all the data to the new work object using the mergepage param in createworkpage but the new work created always has a assignment error when created using spinoff activity

My originating work has multiple page and pagelist which I need to copy thus making it a little complicated

any idea why there are assignment errors on the new work created