Declare Trigger Example 2

 Hi All,

In this blog we will see example 2 of declare trigger.



Follow below steps 


1) First create declare trigger

CL = C-C-Art-Work

ID = SFChange


Triggers {TAB} 

Trigger when an instance is

Saved and ...        { Other options = Deleted, Saved, Committed Save, Committed Delete, Saved and ...}


..One of these properties was modified

.SFCFA


Trigger activity

Name = DeleteDeliverablesWhenNoSFC  { Parameter =>  InsKey = .pzInsKey }


Execute = In Background On Copy { Other option is Immediately }


Activity


Steps

1) When 

{checked} Enable condition before this action

Param.InsKey!=""                       if true = Continue Whens                      if false  = Exit Activity

.SFCFA=="SFC"                  if true = Exit Activity             if false = Continue When

.SFCFA=="Financial SWEEP"   if true = Exit Activity             if false = Continue When

.SFCFA=="Financial Agreement"   if true = Exit Activity             if false = Continue When


Jump

When = StepStatusGood      if true = Continue Whens     if false = Jump to later Step       E

On Exception jump to later step label = E


2)  Obj-Browse

PageName = DeliverablePg

ObjClass = Index-C-C-Art-Data-DeliverablesList

MaxRecords = 20

GetRowKey = {checked}

RowKey = pzInsKey

UseLightWeightList = checked


{checked}   .ReportID      Contains      "TU"

{checked}   .pxInsIndexedKey      Is Equal         Param.InsKey

{checked}   .pxIndexCount       Value Only

{checked}  .pxIndexPurpose       Value Only

{checked}   .DeliverableName      Is Equal          "True-Up Report"


Jump

When = StepStatusGood   if true = Continue Whens     if false = Jump to Later Step     E

On Exception = E


3)  Loop = For each embedded Page

When {checked} Enable conditions before this action

DeliverablePg.pxResultCount>0     if true = Continue Whens     if false = Exit Iteration

Step Page = DeliverablePg.pxResults


3.1) When {checked} Enable conditions before this action

D_PopUpTU[CaseID:.ReportID].TUStatus=="Not Yet Started"

if true = Continue Whens        if false = Exit Iteration


3.2)  Obj-Open               Step Page = DeliverableCase

OpenClass = Index-C-C-Art-Data-DeliverablesList

Lock = checked

ReleaseOnCommit = checked

.pxInsIndexedKey =  DeliverablePg.pxResults(<CURRENT>).pxInsIndexedKey

.pxIndexCount = DeliverablePg.pxResults(<CURRENT>).pxIndexCount

.pxIndexPurpose = DeliverablePg.pxResults(<CURRENT>).pxIndexPurpse


Jump

When = StepStatusGood     if true = Continue Whens       if false = Jump to Later Step       PR1

On Exception = PR1


3.3)  Obj-Delete        Step Page = DeliverableCase

Remove = checked


3.4) call CommitData         Step Page = DeliverableCase


3.5)  Label = PR1      Page-Remove             Step Page = DeliverableCase


4) Loop = For each embedded page

When 

.DeliverablePg.pxResultCount>0   if true = Continue Whens      if false = Exit Iteration


4.1) When {checked} Enable conditions before this action

D_PopUpTU[CaseID:.ReportID].TUStatus=="Not Yet Started"

if true = Continue Whens        if false = Exit Iteration


4.2) Obj-Open            Step Page = TUCase

OpenClass = C-C-Art-Work-T

Lock = Checked

ReleaseOnCommit = Checked

.pyID = DeliverablePg.pxResults(<CURRENT>).ReportID


Jump

When = StepStatusGood   if true = Continue Whens        if false = jump to later step    PR2

On exception = PR2


4.3)  Obj-Delete             Step Page = TUCase

Remove = checked


4.4) call CommitData          Step Page = TUCase


4.5) Label = PR2

Page-Remove           Step Page = TUCase


5) Call FlushDataPage

DataPage = D_EditTDeliverables

ParamName1 = CAMCaseID

ParamValue2 = CAMKey

FlushAllInstance = checked


6)  Call FlushDataPage

DataPage = D_ClosedTUDeliverables

ParamName1 = CAMCaseID

ParamValue2 = CAMKey

FlushAllInstance = checked


7) Label = E       Page-Remove

DeliverablePg

TUCase

Deliverable


8) Label = Exit


Pages & Classes

TUCase        C-C-Art-Work-T

DeliverablePg      Code-Pega-List

DeliverablePg.pxResults         Index-C-C-Art-Data-DeliverablesList

DeliverableCase         Index-C-C-Art-Data-DeliverablesList

D_EditTUDeliverables      Code-Pega-List

D_EditTUDeliverables.pxResults        Index-C-C-Art-Data-DeliverablesList

D_ClosedTUDeliverables       Code-Pega-List

D_ClosedTUDeliverables.pxResults         Index-C-C-Art-Data-DeliverablesList


Thank you!! Will see you all in next blog post 😊


Comments

Popular posts from this blog

pxSubscript and pxListSubscript Properties In Pega

Frequently Used Date Expressions In Pega

pyForEachCount In Pega