In SmartForm widget in WAB, you were able to set a preset value.
For example, was able with minimum JS to preset a field with the user's email who logged in to the app.
Is it possible to do so in the Editor widget in JS 4.x? Can it be done using the valueExpression of the Element and define the preset value?
Hi @LefterisKoumis ,
Thank you for posting your question.
You will need to create a Calculated expression in Smart Forms using the Arcade getUser function. You should be able to copy this script:
var userInfo = GetUser();
if(HasValue(userInfo, "email")){
return userInfo.email;
}
Here's a sample for this example: Preset User Email (arcgis.com)
The expressions you create in your Smart Forms will be executed when you edit features using the Editor widget. There are examples of how to configure Calculated expressions in the Smart Forms using the Map Viewer, in this blog: From the Smart Editor to Smart Forms (esri.com)