web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Issuue with UpdateIf f...
Power Apps
Unanswered

Issuue with UpdateIf function

(0) ShareShare
ReportReport
Posted on by

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).

form5.PNG

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)

managerscreen.PNG

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:

itscreenafterapprovebymanager.PNGIf the team approved the submission, the user should see a success screen as follows:

submission approved.PNG

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:

sharepointlistafteradding.PNG 

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.

Categories:
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard