Hello mates,
So basically, what I want is when the 2nd submit button is clicked, for it to check the code and the if statement in the 1st submit and if satisfied, to go ahead and run the code in button 1 which will add the number.
Whenever I click on either button, it seems to ignore the 2nd if and just add the number regardless.
Here is the code:
The varSubmit is the second submit button which has Set(varSubmit,Select(btnSubmit_7)) on its OnSelect. btnSubmit_7 is the 1st submit button.
If(
CountRows(errorGallery.AllItems) < 1,
Patch(
Leads,
Defaults(Leads),
{
LeadContactName: txtContactName.Text,
LeadPhone: txtContactPhone.Text,
LeadContactNotes: txtNotes.Text,
LeadEntryDate: Date.SelectedDate,
AgentEmail: vAgent.AgentEmail,
crb4e_lead: Concatenate(
txtContactEmail.Text,
" -- ",
Now()
)
}
),
varSubmit && CountRows(errorGallery.AllItems) > 1,
Patch(
Leads,
Defaults(Leads),
{
LeadContactName: txtContactName.Text,
LeadPhone: txtContactPhone.Text,
LeadContactNotes: txtNotes.Text,
LeadEntryDate: Date.SelectedDate,
AgentEmail: vAgent.AgentEmail,
crb4e_lead: Concatenate(
txtContactEmail.Text,
" -- ",
Now() )}
);
UpdateContext({varResubmit: true})
);