I have a form that I am trying to use to enter in some data into my list (myList). Depending on what fields they complete some other columns become visible. So when a user selects a value in a dropdown field, it changes the text that is displayed on a button (this part is working). Based on the text on the button, I want to set the value of another dropdown. This is what my code looks like so far in the OnSelect of my button
UpdateContext(
{
Error1: If(
IsBlank(Trim(DataCardValue2.Value)),
"This field is required",
""
),
SumError: If(
IsBlank(SumAmntVar),
"This field is required",
""
),
AgError: If(
IsBlank(DataCardValue4.Selected),
"This field is required",
""
),
DetailError: If(
IsBlank(Trim(DataCardValue6.Value)),
"This field is required",
""
),
AmntError: If(
IsBlank(Trim(DetAmt_Value.Value)),
"This field is required",
""
)
}
);
Switch(
btnSubmit.Text,
"First Scenario",
If(
!IsBlank(Error1) || !IsBlank(SumError) || !IsBlank(AgError) || !IsBlank(DetailError) || !IsBlank(AmntError),
// Has errors - don't submit
Notify(
"Please complete all required fields before submitting.",
NotificationType.Error
),
// No errors - submit
If(
!IsBlank(SharePointIntegration.Selected),
Patch(
'myList',
//SharePointIntegration.Selected,
LookUp('myList', ID =ThisItem.ID),
{
Status: {Value: "Pending 1st approval"}
}
)
);
SubmitForm(myForm);
//RequestHide(); Refresh('myList');
Notify(
"Request submitted successfully!",
NotificationType.Success
)
),
"Second Scenario",
If(
!IsBlank(Error1) || !IsBlank(SumError) || !IsBlank(AgError) || !IsBlank(DetailError) || !IsBlank(AmntError),
// Has errors - don't submit
Notify(
"Please complete all required fields before submitting.",
NotificationType.Error
),
// No errors - submit
If(
!IsBlank(SharePointIntegration.Selected),
Patch(
'myList',
//SharePointIntegration.Selected,
LookUp('myList', ID =ThisItem.ID),
{
Status: {Value: "Pending 2nd Approval"}
}
)
);
SubmitForm(myForm);
Notify(
"Request submitted successfully!",
NotificationType.Success
)
)
);
After the validation is done, the first scenario in my Switch statement works and the Status field is updated correctly. However when the second scenario is the case, the Status field is not being updated. What am I doing wrong here? I just want to update the Status field in each scenario...appreciate the eyes and help.
Update: I had a typo on the original snippet I posted, but have now corrected it. The issue is still happening.