How to send an email and as well as an excel report to the lead if the case breaches SLA.

I have a requirement like suppose if the case is routed to manager for approval but the manager does not approves the case within an hour so email notification should be to the manager everyday at 4pm IST and as well as the number of cases that this manager didnt approve within the given goal time then that excel report should be send to my lead.

How to achieve this requirement.

Please find the attachment for SLA and approval flow

The goal is 30 mins and deadline is 1 hour

Hi@TanyaS58

The high level design for the above requirement is as follows:

  1. You can create an escalation action on deadline execution where you can store the necessary case data that was not approved by the manager.

  2. You can create a data type for this to have a record of cases that went through SLA breaches.

  3. Next create a job scheduler that will be run everyday at 4pm IST.

  4. The job scheduler activity will be responsible to send the consolidated email with the all necessary data that you have stored in point 1.

  5. Just remember to send the email successfully check whether an email account is configured in the system and an email correspondence rule needs to be configured as well.

  6. You can SendEmailWithAttachments activity for sending out the email.

  7. Now for the second part of the requiement you need to create a report definition based on the data type created in step 2.

  8. Provide the columns that you want to show on the excel report and also provide the required filter conditions so that the data for each day is only being sent to the excel.

  9. Once all these configurations done, you can store the report data to a pagelist property with the help of a data page.

  10. Use this pagelist property to execute pxGenerateExcelFile activity.

  11. Once you get the desired excel report you can use SendEmailWithAttachments and pass the excel report as an attachment and send the email.

Below are few links that will help you to achieve the above requirement based on above design:

@SoumyajitB Step 1 and step 2 I am not that clear like see For breaching the deadline I configured a notify action but how to store the data of the cases that are breached (on the basis of which property that data type i need to create) and what steps do i need to give in the activity of the job scheduler? and also I am configuring one report definition rule but here also I am struggling to find the correct link between the property so that I can know this case was breached.

I am attaching that screenshot as well.

Hi@TanyaS58

I am providing the answers point wise:

  1. For deadline action you configure an escalation activity which will automatically trigger when deadline time is breached.

  2. In this activity/data transform you can push properties like pxdeadlinetime, pxCreateOperator, pxUpdateOperator, pyID, pzInsKey and other properties as per your requiement and store it to a data type defined on a data class like ABC-Data-SLABreahces.

  3. Next configure a job scheduler to run at 4pm IST everyday. Just call SendSimpleEmail activity within the job scheduler activity.

  4. Remember to pass the necessary params to SendSimpleEmail.

  5. The email correspondence will contain the data stored in above mentioned data type. If you want you can also show the breached cases information in a tabular format in the correspondence rule.

  6. For goal level escalation action you just need to provide an escalation activity which will call a report definition on the same data class as mentioned earlier. If you want to use pxAssignedOperatorID as a report column then you might need to join with Assign- class.

  7. Provide the columns and filters in the report definition as per requirement.

  8. Now run the report using Call Rule-Obj-Report-Definition.pxRetrieveReportData step in the activity and store the data in a pagelist.

  9. Optionally if you want some data massaging you can do the same by looping on the pagelist.pxResults.

  10. Otherwise you can directly use pxGenerateExcelFile to generate the excel file. I have attached an image of activity steps showing the generation of excel file using report definition.

  11. In order to send the excel report you can use SendEmailNotification in the activity. Alternatively you can visit this link which will replicate my words. Attach Excel file to email | Support Center

@TanyaS58 To export the cases to Excel, this article may help - Export Data Page (list) to Excel | Support Center. We can perhaps use a data page to get the cases that missed the approval. Then to attach the Excel file to email and send, this article may help - Attach Excel file to email | Support Center

@Will Cho actually I am not using a data page ,in the activity I am fetching the results from report and I want that data to be exported in excel as I am planning to loop through the pxresults page list of the report.

@TanyaS58

I guess you want to fetch the cases whose pySLADeadline is on or before current date time. So I have a provided a screenshot with the filter condition. Have a look and let me know if this is what you want.

@TanyaS58 right, the fetching can happen using any technique like report, data page, obj-browse, etc. Then in the activity, call pxGenerateExcelFile and the mapping can be done using this type of syntax {MySampleDataTypeListFiltered.pxResults().pxCreateDateTime} as defined in the Excel template. You can also directly reference the data page (D_*) in Excel (except parameterized DP). The article will show more if any configuration help needed.

@TanyaS58 thank you @SoumyajitB and @Will Cho for your prompt responses,my issue has been resolved now.As i was fetching the results from a RD so in template file i gave the reports.pxResults as the pagelist property to fetch the properties and on executing pxGenerateExcelFile in step page also i gave my reports page name and that approach worked for me.

@SoumyajitB Thankyou for explaining in great detail.I just want to know on deadline if I am triggering an activity like in step 29 In this activity/data transform you can push properties like pxdeadlinetime, pxCreateOperator, pxUpdateOperator, pyID, pzInsKey and other properties as per your requiement and store it to a data type defined on a data class like ABC-Data-SLABreahces.)so how will it get stored to the data type?that i will create I am not getting this part do i need to create a data type like SLA Breach and add properties and then on the escalation of deadline i need to append all these properties in that data type?

Also can it be done like suppose i call a report definition and then in job scheduler i am sending email everytime at 4pm.

But here i am not getting one more thing is that how at 4pm the job scheduler will know that SLA was breached if we are notifying on deadline action?

@SoumyajitB Also I was trying for one approach like calling a job scheduler at 4pm ist and in the activity fetching a RD to get the details of SLA Breached cases but my report itself is not fetching any data.And I am not able to debug it.

Attaching the screenshot of my report here:

I have a used a filter in my report like difference in minutes between slaDeadline and current time to get the breach cases.

Report for SLA.docx (312 KB)

@TanyaS58

Answer to the first question is yes you need to create a data type containing the properties and on escalation just add a row in it.

For the second question the answer yes you can do it.

And for the third question you need to keep a flag in the data type which will be defaulted to false and once processed by job scheduler it wll become true. So the job scheduler activity in each run will only look for false records and execute the other steps, if no record found with false value then it will exit the activity and no email will be send.

@Will Cho I am getting the results in the excel as blank.Please find the screenshot attached.And I am not using any parameterised data page also.Eventhough both my Report and data page are fetching 12 records I am getting blank excel generated.Please refer to the screenshot of my template as well

Blank Excel .docx (358 KB)

@TanyaS58

I don’t think you need to do a page copy, you can directly call pxGenerateExcelFile by providing the step page as D_SLABReach. Make sure in page and classes D_SLABReach should be pointed to Code-Pega-List and D_SLABReach.pxResults should be pointed to the list data page class.

@TanyaS58

Do you have any errors in the tracer?

Can you also try to pass the key of binary file in the same format but not in all capitals, meaning in the same casing as the actual rule.

webwb!ReportsSLA!xlsx

@TanyaS58 i’m not sure if “.pxPages(A)” reference will work in the Excel template. I haven’t tried that pattern. For now, can you remove it and try again? I would first start with just one column in the Excel template and add more later.

@Will Cho ya sure i will try with this approach as well

@SoumyajitB thankyou for your prompt responses actually I will go with the 2nd approach that is the activity fetching the report and then sending the data as excel to the lead however in doing so i need 2 inputs from you

1.Regarding Job scheduler configuration (as it needs to run at 4pm daily)so please see the screenshot attached and advise me what should be there in Every days blank .

2.Now my RD is working so how to configure the activity that it converts the data fetched by report in excel and then send it to my lead as well as to the manager .Because in one of your configurations I saw that after looping the Report results pxGenerate was called so how will it work as the file will be downloaded in my machine so how the excel report will be shared to the lead?

@SoumyajitB actually yes I mean if the case Deadline is after the current date time that means the case has not yet breached the SLA but if it is before the current date time then it means it has breached the SLA

@SoumyajitB so if i mention it in pages and classes then will the excel generate result?