Posts

Refresh a section on client using JavaScript

Just execute the following JavaScript function:

pega.api.ui.actions.refreshSection({section: "MySection"})

Of course, we can set a parameter to run a data transform or call an activity. Keep reading!

Using the PDFBox library to embed an Image to a PDF document

I tried to embed an image into a PDF using the apache POI and iText libraries but none of them worked to me. So I tried with the pdfbox library and it worked!

Java function to create a PDF document with an embedded image

Image

In this post I will show a Java function that pastes an image into a brand new PDF. The input and output of this function will be Base64 encoded.

Why did I need it? The client requested that the images attached to the case be converted to PDF in order to be sent to a service that only accepts PDF documents.

How to call an activity from the client using the "asyncRequest" JavaScript function

Image

Here is an example where we invoke the pyUtilityStub activity using the POST method by sending GET and POST parameters at the same time:

var oSafeURL = new SafeURL("@baseclass.pyUtilityStub");
oSafeURL.put("pzPrimaryPageName", "pyWorkPage");
oSafeURL.put("parameterGet1", "valueGet1");
oSafeURL.put("parameterGet2", "valueGet2");

var postData = new SafeURL();
postData.put("parameterPost1", "valuePost1");
postData.put("parameterPost2", "valuePost2");

pega.u.d.asyncRequest("POST", oSafeURL, null, postData);

How to discard a rule from another operator

Image

Yesterday, I ruined my Dev Studio access because I private-edited an OOTB rule (pzpega_ui_invoke.js). So I needed to discard it urgently or I would lose my operator and all my work. Unfortunately I no longer had access to the Dev Studio using my operator so I needed to do it from another operator. Here's how I accomplished it.

Using the "RemoveDeletedObjects" function to remove objects from a table

First, we need to mark every object to be removed by setting their property .pyDeletedObject to true.

Then, apply the following function:

@Utilities.RemoveDeletedObjects(TopPage.MyPageList)

After applying this function, the marked elements will be removed from the page list.

How to Accept/Clear a Signature using custom buttons

Sometimes the Accept and Clear action links of the Signature control are very limited for us because we need to add some custom styling or perhaps add our own logic to them. In this post we are going to create buttons that perform the same actions as the standard Accept and Clear links.