Obj-Delete and Obj-Delete-By-Handle in Pega
Today We will see how to use Obj Delete in Pega and how to use Obj-Delete-By-Handle in Pega.
This method is used to delete record from database. What is the difference between these two method??
- If u don't know the Key (pzInsKey) of the record and U have to delete the record then U have to use Obj-Delete.
- If u know the Key(pzInsKey) then U can use Obj-Delete-By-Handle to delete the exact record.
Lets see how to use these two method in pega.
OBJ-Delete-By-Handle
My Local Table record is shown below.
Now lets create one activity in Work class and Write Code to Delete the record in this table.
Now I am going to delete a record from Table where Title is "Insurance Options" for that I use Obj-Browse
Now it will retrieve the record where title is Insurance Options. And U can see GetRowKey is enabled, that means it retrieve key also to clipboard.
Lets Check key is available or not in clipboard.
pzInsKey is there so we can use this key to Delete this record. Lets Do it
Now in 3 rd Step I Loop through all the records available in CourseRecords.pxResults PageList and Copy the Key to a Local Variable Named Key.
In 3.1 th Step I used Obj-Delete-By-Handle
Here I pass the Key Value to Delete . This indicates we are going to delete the record having the provided Key.
After this step I used Commit Method to Complete the process.
Lets Run and See whether it is deleting or Not.
Activity Run successfully Lets check in Local Table whether value is there or Not.
Now u can see the record is not there in table. We Successfully deleted a record. :)
OBJ-Delete
Lets See How to use Obj-Delete.
I will use this Method When I don't know the Key Value. Lets Delete the record having ID = SAL-002
I used Obj-Open to get the record in Clipboard.
Lets See whether Obj-Open retrieve values in Clipboard
.
Data is there , Now we can delete this record.
Now I added the Method Obj-Delete and Enabled Remove and Immediate Check Box.
And at last I added Commit to complete the transaction.
Lets Run the activity and test whether Record is deleted or Not.
Now U can see the record is not available after delete.
U can see SAL-002 record is not here. Thank u friends for reading and learning with me.If any doubt ask me in comment . Bye :)
ReplyDeleteEnjoyed reading the article above, really explains everything in detail, the article is very interesting and effective. Thank you and good luck for the upcoming articles pega certification
thank you sharing good information we can thought you website dot net online traning
ReplyDeleteTq for sharing .,.. explained in a easy manner
ReplyDeleteThanks :)
DeleteBrilliant One
ReplyDeleteNice and very informative blog. Thanks for sharing
ReplyDeletePega Training Hyderabad
Pega Online Training
Thank you very much for this useful post
ReplyDeleteIf you are getting error while saving, try to use Param instead of .Local in step 3
ReplyDelete