Hello,
I have an IF statement which looks at the selected value of a dropdown box and then depending on the value, it will then create a new record in specified dataverse table. If i was to remove the second condition from the IF statement so its just creating the record in CDA_Conv_Recordss table then it works fine. Only when i add a second condition am i getting the following error message.
Error:
Incompatible type. We can't evaluate your formula because the context variable types are incompatible with the types of values in other places in your app.
Code:
If(
varSelectedEnviro.Value = "Convenience",
Set(
varRecordID,
Patch(
CDA_Conv_Recordss,
If(
varRecordType = "New",
Defaults(CDA_Conv_Recordss)
),
{
Salesforce: Value(varSFAcc),
Employee: varEmployee,
Environment: Dropdown1.Selected.Value
}
)
),
varSelectedEnviro.Value = "Horeca",
Set(
varRecordID,
Patch(
CDA_Horeca_Recordss,
If(
varRecordType = "New",
Defaults(CDA_Horeca_Recordss)
),
{
Salesforce: Value(varSFAcc),
Employee: varEmployee,
Environment: Dropdown1.Selected.Value
}
)
)
);
As I'm writing this, I'm thinking its because I've got the varRecordID being set twice, when technically its only going to be set once depending on the value of varSelectedEnviro. So maybe i need to put the IF statements where the table is defined instead, am i on the right page here?
Any help would be much appreciated, thank you in advance.