
Announcements
Hello, So I am building this small application about a ticket submission form, where there are 5 request types (New Device, DB, Network, Issue, System Issue).
After clicking on Button(Dont worry i'll change that to submit lol), The manager either approves or rejectes the submission (keep in mind, manager screen only pops if the user chose a New device request type)
moving on, lets say the manager approved, the ticket will go to its final destination which is the it team screen to finally decide as follows:
If the team approved the submission, the user should see a success screen as follows:
after some logic, the sharepoint list should add the values with approving status but of course my logic is wrong, u can see the last item is the one we added right now:
So, other than new device request, the manager screen will not pop up, it will go directly to the it team to decide, if it team approved, both it and manager approvals would be set to approved, if it team rejects, both approvals would be rejected. Anyway, So my code for the "Button" (submit form) is : If(
DataCardValue8.Selected.Title = "New Device", // check if the value is new device
Set(isNewDevice, true); // set a global var that indicates the request type is true
Set(managerApproved, false); // set a global var that indicates the decision was rejected by manager
Navigate(ManagerApprovalScreen),
Set(isNewDevice, false); // if other options were chosen
Navigate(ITTeamScreen) // go to it team screen for final decision
)
And for the manager screen approve button, the code is (the approvals are set to Pending by default ONLY in the powerapps, not the sharepoint list if u were wondering):
Set(
managerApproved,
true
);
// make global var true if approved button is clicked, which is now
UpdateIf(
Ticket,
RequesterEmail = DataCardValue15.Text && RequestType = DataCardValue8.Selected.Title && ManagerApproval.Value = "Pending",
{
ManagerApproval: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value: "Approved"
}
}
);
Navigate(ITTeamScreen);
// go to it team page for final decision
And lastly the it team approve button:
// Check if the ticket can be processed
If(
!isNewDevice || (isNewDevice && managerApproved),
// Logic to submit the form and notify
SubmitForm(Form5);
Notify("Ticket Approved by IT Team"),
// If the condition is false
Notify("Ticket cannot be processed")
);
// Update the SharePoint list item
UpdateIf(
Ticket,
RequesterEmail = DataCardValue15.Text && RequestType = DataCardValue8.Selected.Title && ITTeamApproval.Value = "Pending",
{
ITTeamApproval: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value: "Approved"
}
}
);
// Navigate to success screen and reset variables
Navigate(
'Sucess screen',
ScreenTransition.Fade
);
Set(
isNewDevice,
false
);
Set(
managerApproved,
false
);
As u can see, i tried using conditions to specify the record that the user is submitting, bcs the form isnt submitted until approvals are done. and before that, my condition was if there was an item with "Pending", just change it to Approved (thats why there is approvals on the first several items). I also didnt mention rejection logic bcs its almost the same as approve. Please help me, i spent the last 2 days trying to solve this. For recap: When the manager approves, His approval should be set to Approved, And when the it team approves, the field of their approval should be set to Approved, the it team can reject the manager decision and it would be like the following: ManagerApproval: Approved, ITTeamApproval: Rejected, But if the manager rejects the submission the program ends.
Please bear with my english for i am not a native as you can tell, also i forgot to mention i used patch and update and they were a red flag for me due to many errors, but i maybe mistaken, i seek help.