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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,904)