cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Dual Super User II
Dual Super User II

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
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Check out the Power Apps Community Call for January 2021

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (3,807)