Activity Page methods in pega

The Page- methods are the activity steps that create, copy, clean and remove pages on the clipboard. Almost every activity that works with more than one page uses at least one of them, so it pays to know exactly what each one does and does not touch.

The methods

MethodWhat it does
Page-NewCreates a page on the clipboard, top-level or embedded. A model can fill it with starting values
Page-CopyCopies the contents of a source page to a new or existing destination page. The source is not changed
Page-RemoveDeletes one or more pages from the clipboard. The database is not affected
Page-Set-MessagesAdds a message to a page. A page with a message normally cannot be saved to the database
Page-Clear-MessagesRemoves the messages from a page so it can be saved or validated again
Show-Page and Show-PropertySend the page or property to the browser for debugging. Use only while developing

Page-New

Use it to make a working page. Give it a name and a class, and optionally a model or data transform that sets defaults. The new page lives only on the clipboard until you save it.

Page-Copy

Use it to duplicate data, for example to copy a customer page from a data page onto your case, or to keep a backup before you change something. If the destination already exists, the copied properties are added on top of it.

Page-Remove

Clean up temporary pages when you have finished with them. It only removes them from memory. A record saved in the database stays there.

A worked example

A bank activity needs to check a customer's address without changing the case.

  1. Page-New: create TempCustomer of class Bank-Data-Customer.
  2. Page-Copy: copy D_Customer onto TempCustomer.
  3. Property-Set on TempCustomer: standardise the address.
  4. Page-Set-Messages on the case if the address is invalid.
  5. Page-Remove: remove TempCustomer.

Tips

  • Always pair a Page-New or Page-Copy with a Page-Remove when the page is temporary, or the clipboard grows during long sessions.
  • Do not leave Show-Page steps in production activities. They are meant for debugging.
  • When you only need to change data, consider a data transform, which is easier to read than a chain of page steps.

Related: The step page, clearing messages in a data transform and the Activity label.

No comments:

Post a Comment