Question
Cognizant
Last activity: 26 Oct 2016 5:58 EDT
After a loop, commit method lost data in activity
hi all,
i have an issue about commit method in activity.
in activity, i called page-new then used obj-save in loop.(using same page name as step page when i use page-new)
after the loop, the commit method is called. but only the last one in page list is saved to database.
does anyone know the reason why? and a way to commit all data into database in the situation ?
Thanks, and the pega version is 7.1.9
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
CGI Netherlands
NL
Hi,
The steps you performed are correct. They should be in the deferred save list and the commit will save all of them.
My guess is you may be overriding the same primary key's each time. May be you can try logging the Primary key each time you do a obj-save. Most cases primary key may be pxInsKey or else check the key's present in the Class.
Areteans Technologies
AU
Are you mentioning Step page name (the one you created) in Commit step ? If not do so, it might help
Cognizant
hi
thanks for your reply.
i tried but it's not work...
Accepted Solution
CGI Netherlands
NL
Hi,
The steps you performed are correct. They should be in the deferred save list and the commit will save all of them.
My guess is you may be overriding the same primary key's each time. May be you can try logging the Primary key each time you do a obj-save. Most cases primary key may be pxInsKey or else check the key's present in the Class.
Incessant Technologies
IN
Hi,
Select the WriteNow checkbox and verify. Although this is not recommended, this should solve your problem. Clear the writenow checkbox if your activity is of type Trigger,Uitility, Notify and Route.
Incessant Technologies
IN
I think your step page is changing with every step of loop ? if yes then, after loop the step page will have the last page only and that is what you are comitting. So instead of comitting after loop if you need to save each page then put commit inside loop and try. Hope this will solve your issue - Rajesh
Cognizant
hi all,
thanks for your reply all. now, i fixed that issue.
the way is create a new activity to commit each object.
and in outer loop, use queue to call the activity.
then, all data is committed into database.