Select to view content in your preferred language

Preset value in Editor widget

601
1
10-26-2023 08:22 PM
LefterisKoumis
Frequent Contributor

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?

@AlixVezina 

 

0 Kudos
1 Reply
AlixVezina
Esri Regular Contributor

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)

AlixVezina_0-1698414061330.png

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)

 

 

0 Kudos