cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AD1990
Helper II
Helper II

Standalone patch function works on a button but gives error when put in conjunction with other functions

So, I have a form where the students can apply for classes under a specific teacher.

This screen has a text box with a text box where the student can type anything and then ticks the 'i agree to the terms and conditions' checkbox and then clicks on the submit button.

The submit button will check that the checkbox is ticked, update a sharepoint list with the required data, trigger email to the teacher keeping the student in cc and then the button itself will disappear.

OnSelect property of the button has this code:

 

If(Checkbox1.Value = true,
Office365Outlook.SendEmail(
"xxxxxxx@xxxxxx.com",
"Applying for tuition",
"You have a pending access request.
Requested by: " & currentUser.FullName
& "
Requesting tuition under you for subject"
& Upper(varComp)
,{Cc:currentUser.Email,Importance:"High"}
)

&&
Notify(
"The teacher has been notified that you have applied for tuition. Kindly wait for a response from them.",
NotificationType.Information
)

&&

Set(varVisible1, "666")
&&<--------code given below in italics goes here------->

,
Notify("Please accept the terms and conditions before clicking on submit",NotificationType.Error)
)

The above code works perfectly.

But when I append the below code, the patch functions throws an error.

 

Patch
(
'Teaching',
Defaults('Teaching'),
{
Tuition_Status: {Value: "Applied"}
}
)

 

The patch functions works perfectly fine as a standalone function.

 

Any suggestions?

 

PS: The variables set here are for disabling the button. Ignore that part

1 ACCEPTED SOLUTION

Accepted Solutions
StalinPonnusamy
Super User
Super User

Hi @AD1990 

 

Just noticed and we can change the order a bit.

 

If(Checkbox1.Value,
Patch Function;
Send Email;
Notify function;
Set Variable;
,
Notify("Please accept the terms and conditions before clicking on submit",NotificationType.Error)
)

 

Please let me know if any help with this.


Thanks,
Stalin - Learn To Illuminate

View solution in original post

3 REPLIES 3
StalinPonnusamy
Super User
Super User

HI @AD1990 

 

Here are the Overall Steps;

If(Checkbox1.Value,

Send Email;
Notify;
Set Variable;
Patch Function
,
Notify("Please accept the terms and conditions before clicking on submit",NotificationType.Error)
)

 


Thanks,
Stalin - Learn To Illuminate

StalinPonnusamy
Super User
Super User

Hi @AD1990 

 

Just noticed and we can change the order a bit.

 

If(Checkbox1.Value,
Patch Function;
Send Email;
Notify function;
Set Variable;
,
Notify("Please accept the terms and conditions before clicking on submit",NotificationType.Error)
)

 

Please let me know if any help with this.


Thanks,
Stalin - Learn To Illuminate

Thanks. This was the perfect solution.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,142)