cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Conditionally required fields on a SP list using patch

Hi everyone,

 

I have a SP list with a custom power apps form, I am required to use patch as part of the submit/save function to pull in external data from a lookup. 

 

I also, ideally, need to have a field which is conditionally required (depending on the response to another question). 

 

I have managed to acheive this in a test list but only where patching is not part of the saving. When I try to acheive the same but also using patching, the item saves regardless. I have attempted to amend my patch formula using an IF statement, such as described in the following article, but I have yet to get this to work:

 

https://powerusers.microsoft.com/t5/General-Discussion/Advice-for-Conditionally-Required-Fields/m-p/...

 

My patch formula (or an example of the one I am using), is as follows:

 

If(SharePointForm1.Mode=New,
Concurrent(Patch('test',Defaults('test'),
{
Title:DataCardValue1.Text,
Mandatory:DataCardValue6.Selected,
MandatoryText:DataCardValue3.Text
});
ResetForm(SharePointForm1),RequestHide()
)
,
Concurrent(
Patch('test',SharePointIntegration.Selected,

{
Title:DataCardValue1.Text,
Mandatory:DataCardValue6.Selected,
MandatoryText:DataCardValue3.Text
});
ResetForm(SharePointForm1),RequestHide()
)
))

 

Is anyone able to advise, firstly if this is possible, and if so, what options are available to acheive what I am looking to do?

 

Thanks in advance

1 REPLY 1
Highlighted
Dual Super User III
Dual Super User III

Re: Conditionally required fields on a SP list using patch

Hi @MarkWhitfield 

 

Can you try to remove the concurrent function?  This is because we donot know the order of execution inside the concurrent function.
 
If(SharePointForm1.Mode=New,
Patch('test',Defaults('test'),
{
Title: DataCardValue1.Text,
Mandatory: DataCardValue6.Selected,
MandatoryText: DataCardValue3.Text
});
ResetForm(SharePointForm1);RequestHide()
,
Patch('test',SharePointIntegration.Selected,
{
Title: DataCardValue1.Text,
Mandatory: DataCardValue6.Selected,
MandatoryText: DataCardValue3.Text
});
ResetForm(SharePointForm1);RequestHide()
)
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,247)