Skip to content

Instantly share code, notes, and snippets.

@bokks
bokks / mashup_openwork.php
Last active January 3, 2018 07:00
This is a dynamic page which serves the mashup demonstrating open work by item action.Copy the code below and paste into http://phpfiddle.org/deposit/widget001.php and run it.
<!DOCTYPE html>
<html>
<body>
<div> Open Work Example </div>
<?php
$workid = "S-44";
/* In a production scenario, this id would be retrieved dynamically maybe from a rest service which takes in a few input search
parameters and returns the id, like get me the id of the loan application of ApplicantName = xxx
*/
@bokks
bokks / mashup_openassignment.php
Last active January 3, 2018 07:01
This is a dynamic mashup demonstrating openAssignment action. Copy the code below and paste into http://phpfiddle.org/deposit/widget001.php and run it.
<!DOCTYPE html>
<html>
<body>
<div> Open Assignment </div>
<?php
$assignid = "ASSIGN-WORKLIST MYORGB7U7Z-UPLUSFINANCIAL-WORK S-43!GATHERAPPLICANTINFO_FLOW_0";
/* In a production scenario, this id would be retrieved dynamically maybe from a rest service which takes in a few input search
parameters and returns the id, like get me the id of the loan application of ApplicantName = xxx
*/
@bokks
bokks / mashup_openWorkByHandle.php
Last active January 3, 2018 07:00
This is a mashup loading a dynamic content using openWorkByHandle action.Copy the code below and paste into http://phpfiddle.org/deposit/widget001.php and run it.
<!DOCTYPE html>
<html>
<body>
<div> Open Work Example </div>
<?php
$workid = "MYORGB7U7Z-UPLUSFINANCIAL-WORK S-45";
$classname = "MYORGB7U7Z-UPLUSFINANCIAL-WORK";
/* In a production scenario, this id would be retrieved dynamically maybe from a rest service which takes in a few input search
parameters and returns the id, like get me the id of the loan application of ApplicantName = xxx
*/
@bokks
bokks / EncryptionPattern1.jsp
Last active June 22, 2020 17:16
This is an encryption pattern that is useful for encryption of url literals in the jsp/html directly
/* This pattern is useful when the url is a literal in the markup */
/* Example 1 */
/* Original */
<td id="navigationTD" nowrap class="textCoverLabel" style="padding:0px 5px 0px 5px">
<a href="<pega:reference name='pxRequestor.pxReqURI' mode='normal' />?pyActivity=Open&Action=Review&HarnessPurpose=Review&AllowInput=false&InsHandle=<%=tools.getStepPage().getInstanceHandle()%>" title="Open this" class="titleBarLink">Open Item</a></td>
</td>
/* Encryption notice how even dynamic parameters can be encrypted*/
<td id="navigationTD" nowrap class="textCoverLabel" style="padding:0px 5px 0px 5px">
@bokks
bokks / EncryptionPattern2.jsp
Created June 22, 2020 17:24
This is an encryption pattern for URLs that are stamped in the inline scripts of Stream rules
<%tools.putSaveValue("CAPTION-Task", tools.getLocalizedTextForString("pxRequestor.pyCaption","Task"));
tools.putSaveValue("CAPTION-WaitingAt", tools.getLocalizedTextForString("pxRequestor.pyCaption","WaitingAt"));
%>
/* Original */
<script>
function displayFlowLocation(asnKey)
{
strURL = strRequestorURIformFlows + "?pyActivity=Work-.GetLocationForAssignment&InsHandle=" + escape(asnKey);
openUrlInWindow(strURL,"FlowLocation","status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,left=20,top=20,height=600,width=750");
}
@bokks
bokks / EncryptionPattern3.jsp
Last active July 11, 2022 13:36
This patterns gives tips on using SafeURL with encryption in Stream Rules . Also when you should use Thread vs Requestor.
/* Note that this is for Stream rules */
/* Below snippet is a JS function in a control performing a server call */
/* Important Tip
Use encryption when you already have code using :
httpRequestAsync
pega.util.Connect.asyncRequest
openWorkByURL
openURLInWindow
*/
<script>
@bokks
bokks / RegistrationPattern1.jsp
Last active January 6, 2021 20:35
This pattern shows how to easily perform Activity registration using pzRegisterActivity
/* This shows how to convert a regular SafeURL to a Dispatcher URL */
/* The normal URL would be like pyActivity=Work-.AttachmentStatus&AttachmentHandle=XXX */
/* When you pass the SafeURL to pega.u.d.convertToRunActivityAction(oSafeURL) , the URL becomes a dispatcher */
/* pyActivity=pzRunActionWrapper&pzActivity=Work-.AttachmentStatus&AttachmentHandle=XXX&pzActivityParams=AttachmentHandle */
/* pzRegisterActivity or long form of registration works only with such Dispatcher URLs */
<script>
function CheckAttachmentStatus(LinkHandle,strAttachmentHandle)
{
var oSafeURL= new SafeURL("Work-.AttachmentStatus",getReqURI());
@bokks
bokks / EncryptionPattern4.js
Created June 23, 2020 18:02
This is pattern for RedirectAndRun
/* In case of RedirectAndRun where the Location parameter is also a URL */
/* Both of them need to be encrypted */
switchMyApps:function(accessGroup) {
if (accessGroup == null) {
return;
}
var topWinTmp;
var oShowDesktopUrl;