Hi Warren,
I'm so sorry for the back and forth, please note that I'm only a business user by trade so in short, do not really know what I'm doing :( but I appreciate your patience in helping me out.
varInitialApprover/varFinalApprover code = I do not know where else to get the code as I only have the Update Context in the OnSelect of the Submit button which is where the variables are created. I expanded the Update Context code provided by timl to have other fields. The Submit button is in the New/Edit form where a user submits a request and also where the approvers go into Approve or Reject a request.
Here are the steps in the app:
1) A user submits a new request then the user will receive a confirmation email with a cc: Initial Approver (hard-coded to the my email for now). Request's Approval Status updates to Pending Approval.
2) Initial Approver = updates the form's Approval Status to Initial Approval Complete (if approved) or Rejected. After the Initial Approver clicks on Submit, the app is suppose to send another email to inform the Requester of the new status and cc's: to the Final Approver (hard-coded to my email for now).
Request's Approval Status updates to Initial Approval Complete.
3) Final Approver = updates the form's Approval Status to Final Approval Complete (if approved) or Rejected. After the Initial Approver clicks on Submit, the app is suppose to send another email to inform the Requester of the new status and cc's: to the Initial Approver (hard-coded to my email for now).
Request's Approval Status updates to Final Approval Complete.
Submit Button's OnSelect Property:
UpdateContext({
varPortfolio: DataCardValue6.Selected.Value,
varProjectName: DataCardValue7.Text,
varRequestedAmount: DataCardValue23.Text,
varRequesterEmail: DataCardValue12.Selected.Email,
varProjectApprovalStatus: DataCardValue10.Selected.Value,
varInitialComment: DataCardValue8.Text,
varFinalComment: DataCardValue18.Text,
varInitialDate: DataCardValue24.SelectedDate,
varFinalDate: DataCardValue9.SelectedDate,
varInitialApprover: DataCardValue25.Selected.DisplayName,
varFinalApprover: DataCardValue19.Selected.DisplayName
});
Form's OnSuccess Property:
Notify("varProjectApprovalStatus: " & varProjectApprovalStatus);
Switch(
varProjectApprovalStatus,
"Pending Approval",
Notify("Sending Email for Pending Approval status...");
Office365Outlook.SendEmailV2(
varRequesterEmail ......
Or 4) Either of the approvers can also Reject a request. The Rejection step is what prompted me to create this post.
Because if the Initial Approver's decision = approved but the Final Approver's decision = rejected, I would like the app to send an email to the user with the following information where it will show the requester, what was the Initial Approver's action vs the Final Approver's action.
This is why in the below, I have 2 sections below which is part of the Rejection email and would like the fields to dynamically populate.
<b>Approval/Rejection Information:</b><br>
<b>Initial Approval/Rejection Status:</b> " & varProjectApprovalStatus & "<br>
<b>Initial Approval/Rejection Date:</b> " & varInitialDate & "<br>
<b>Initial Approval/Rejection By:</b> " & varInitialApprover & "<br>
<b>Initial Approval/Rejection Comments:</b> " & varInitialComment & "<br><br>
<b>Final Approval/Rejection Status:</b> " & varProjectApprovalStatus & "<br>
<b>Final Approval/Rejection Date:</b> " & varFinalDate & "<br>
<b>Final Approval/Rejection By:</b> " & varFinalApprover & "<br>
<b>Final Approval/Rejection Comments:</b> " & varFinalComment & "<br><br>
Apologies for the long-winded response, in short, the varInitialApprover & varFinalApprover are only used in the OnSuccess property of the form for the app to send emails based on the Approval Status. The same goes for all the variables in the Update Context property.
Thank you so much again, Warren!