functiondatepega

currentDate in correspondence rule Pega


Currently working in Pega8.6.1, we want to put in an email(correspondence rule)/document a date field that shows a date plus 10 business days. The date should be 10 business days from the creation date of the email. Have tried <%= pega_rules_datetime.pyCurrentDate.addDays("", 10, true, "") %> but am afraid I'm putting it wrong into the correspondence rule. In the generated email this formula is just shown as is. Am fairly new with Pega so bear with me. Working now for about 2 months with Pega and afraid trying to reinvent the wheel.

Is what we are trying to establish even possible in Pega?

Thanks,

John


Solution

  • You can store the +10 days value in a separate property on Primary page of the email.

    For example if pyWorkPage is your Primary page then you can have a separate property for example EmailPlusTen on pyWorkPage.

    Then you can write something like below in a Data Transform or in an Activity rule before calling you email logic.

    .EmailPlusTen = @(Pega-RULES:BusinessCalendar).addDays(@DateTime.CurrentDate("yyyyMMdd",""),10,true,"")

    Then you can directly include property EmailPlusTen in your Correspondence rule by using this tag <<.EmailPlusTen>>

    If you are using an activity to send the email then you can create a Parameter value and set it in the Activity before email logic.

    for e.g.

    Param.EmailPlusTen = @(Pega-RULES:BusinessCalendar).addDays(@DateTime.CurrentDate("yyyyMMdd",""),10,true,"")

    And then include it in Email Correspondence <<Param.EmailPlusTen>>