Page Change Class - Data Transform

Unlike Activity rule, Data transform doesn’t have anything equivalent of ‘Page-Change-Class’ method.

Moreover, if you use a Set action against a page type property (e.g. pyWorkPage.CustomerData) to change its class, it will clear/reset the existing content of the page while changing the page class.

In absence of any appropriate OOTB function or API activity rule to achieve this from a Data transform, you may create a simple function rule with two input parameters -

  • PageName (String)
  • NewClassName (String)
boolean isSuccess = false;
PublicAPI tools = ThreadContainer.get().getPublicAPI();

ClipboardPage targetPage = tools.findPage(PageName, true);

if (targetPage != null)  {
  ClipboardPage tempPage = tools.createPage(NewClassName, "");
  targetPage.putAll(tempPage, ClipboardPage.PUTALL_KEEPNEW);
  isSuccess = tools.getDictionary().validate(targetPage, false);  
}

return isSuccess;

This function can be used to change class of both Top level and embedded pages without losing existing data on such pages.

Thanks

@Nirmalya.SenSharma Thank you,

We tried using Data Transform and Activity rule as well and it worked, same thing in pega rules :slight_smile:

One utility where Step page and class name were parameterized , and calling the same utility from DT using @executeactivity function.