I have canvas app with a SharePoint list as a data source. I have a field called Traveling that is required if the FormMode = New is true and EmpType = Contractor/StaffAug else it is only required if HREdit.Mode = New is false. The following is the formula in Traveling.Required:
If( HREdit.Mode = New, If( EmpTypeDataCardValue18.Selected.Value = "Contractor/Staff Aug", true,false ), true )
The formula in the Submit button OnSelect property is as follows:
The OnSuccess property of the HREdit form is as follows:
When testing the app, the OnSuccess property of the HREdit form seems to run sending the user to the Gallery and displaying the required field error at the top of the gallery. Why is the form submitting if the form is not valid? The Traveling field is a dropdown choice field and not a combo box.
Thank you in advance.
Just curious, is there a reason to let them press the submit button on an incomplete form at all? If not it might be easier to just set the display mode of the submit button to your check, then you will visually be able to see it lock/unlock. Even if you would like them to be able to press the button, and only submit based on the result of your formula, getting the result might be easier to visualize by doing it here first, and once it locks/unlocks as expected then moving it back to the onselect
Your logic seems a little off:
...required if the FormMode = New is true and EmpType = Contractor/StaffAug else it is only required if HREdit.Mode = New is false
Are you stating that if the form is New and the EmpType is as specified that it is required, but that if it is JUST in new mode, then it is not required?
@RandyHayes The FormMode = New is true and EmpType = Contractor/StaffAug it is required, if the FormMode is not new, then it will always be required. Does that make sense?
Not entirely...check this logic table based on what you are saying:
If I follow what you are saying this is what I come up with.
@TheRobRush @RandyHayes No reason to let them push the button. The issue with disabling the button is that the form is quite large and the user will not know what field is missed. Not all fields are required by all users granted not all users can see all fields. Fields are based upon AzureAD group membership. I have variables that are set OnStart to check if the user is in an AzureAD group. If so, set the variable to true. In some cases, a user is part of two different groups. The Traveling field is the only required field and is seen first by either HR or a hiring manager. They are the only two who can edit it and BSD is the only group who can view it. BSD and any other users will not even know the item exists to look at their part until either HR or the Hiring Manager has submitted. The Hiring Manager only submits before HR if the EmpType = Contractor/StaffAug. The Hiring Manager is the one who is required to fill in whether the employee will travel. Otherwise, HR creates the new item, an email is sent to the Hiring Manager with a deep link to the item where the Hiring Manager then would be responsible for filling out the Traveling field. After the following two scenarios, the other users then get an email that there is a new item. Only the Hiring Manager can edit the traveling field.
So was the logic table I sent you correct then?
Then your Required property on the DataCard should be:
(Parent.Mode=FormMode.New && EmpTypeDataCardValue18.Selected.Value="Contractor/StaffAug") || !(Parent.Mode=FormMode.New)
@RandyHayes I changed my formula in the Required property of the Traveler data card to the following but it seems to still be running the OnSuccess property's function of the HREdit form because it is navigating to the Gallery then showing the required field message at the top of the Gallery but not submitting to the SharePoint list. I am testing this in the Power Apps Portal as this is a canvas app that has been live for about 5 months and do not want to publish this while it is not working. I can't see how that would be an issue.
If((Parent.Mode=FormMode.New && EmpTypeDataCardValue18.Selected.Value="Contractor/StaffAug") || !(Parent.Mode=FormMode.New),true,false)
Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.
Your chance to join an engaging competition of Power Platform enthusiasts.