I'm creating a smart form for Field Maps and one of the requirements is to toggle one of the entries to either "Yes" or "No" using a switch. I have the default value set to "No". If the person in the field toggles the switch to "Yes" I want an Arcade expression to update the value for that same record in a date field with the current date of when the switch was toggled to "Yes" for that record.
I tried this but got an error:
Solved! Go to Solution.
When writing any logical function (either IF or IFF), you have to use "==" when evaluating a condition
var inspection_date = $feature.DATE_INSPECTED; /// date field to be changed with Arcade expression
var inspected = $feature.INSPECTED; /// toggle switch field
IIf(inspected == "Yes", inspection_date = Today(), null); /// condition
When writing any logical function (either IF or IFF), you have to use "==" when evaluating a condition
var inspection_date = $feature.DATE_INSPECTED; /// date field to be changed with Arcade expression
var inspected = $feature.INSPECTED; /// toggle switch field
IIf(inspected == "Yes", inspection_date = Today(), null); /// condition
Duh, I overlooked that. Weirdly enough the field populates in map viewer but not in field maps.