Select to view content in your preferred language

Custom arcade popup fine in Map Viewer but buggy in Experience Builder

174
2
Monday
DickieRigdon
Regular Contributor

Experience Builder bug? Arcade expression selects 8 fields, creates new aliases, and places them in the order I want. Works perfectly in Map Viewer. However, if I click on a feature in Experience Builder, the pop-up is nearly empty except for the field name aliases.

Just for a test, I inserted the "Feature Info" widget and it displays all the information perfectly while at the same time the pop-up does not. Please see screenshot.

Thanks for any info!

Used this code originally in Map Viewer, it works fine. I also used the edited code below this and it works fine too in Map Viewer.

Pop-up Code #1

// 1. List your fields in the exact order you want them to display
var orderedFields = [
    { name: "activity", alias: "Activity" },
    { name: "init_type",  alias: "Slide Type" },
    { name: "confidence",  alias: "Interpretation Confidence" },
    { name: "thickness",  alias: "Thickness" },
    { name: "dir_mvmt",  alias: "Direction of Movement" },
    { name: "map_year",  alias: "Year Mapped" },
    { name: "citable_product",  alias: "Citable Product" },
    { name: "citable_product_url",  alias: "Citable Product Link" }
];

// 2. Initialize the arrays required for the Fields Element
var fieldInfos = [];
var attributeValues = {};

// 3. Loop through the array in order
for (var i in orderedFields) {
    var field = orderedFields[i];
    var fName = Text(field.name);
    var customLabel = field.alias;
    
    // Grab the full value safely
    var fieldValue = $feature[fName]; 
    
    // Push the field configuration in the current loop order
    Push(fieldInfos, {
        fieldName: fName,
        label: customLabel
    });
    
    // Pass the actual feature data to the popup
    attributeValues[fName] = fieldValue;
}

// 4. Return the structured dictionary to the popup
return {
    type: 'fields',
    fieldInfos: fieldInfos,
    attributes: attributeValues
};


Pop-up Code #2 (like the above script, this expression also works fine in Map Viewer but not in Experience Builder Pop-ups)

// 1. List your fields in the exact order you want them to display
var orderedFields = [
    { name: "activity", alias: "Activity" },
    { name: "init_type", alias: "Slide Type" },
    { name: "confidence", alias: "Interpretation Confidence" },
    { name: "thickness", alias: "Thickness" },
    { name: "dir_mvmt", alias: "Direction of Movement" },
    { name: "map_year", alias: "Year Mapped" },
    { name: "citable_product", alias: "Citable Product" },
    { name: "citable_product_url", alias: "Citable Product Link" }
];

// 2. Initialize the arrays required for the Fields Element
var fieldInfos = [];
var attributeValues = {};

// 3. Loop through the array in order using for...of to access objects properly
for (var field in orderedFields) {
    var fObj = orderedFields[field];
    var fName = fObj.name;
    var customLabel = fObj.alias;
    
    // Grab the full value safely
    var fieldValue = $feature[fName]; 
    
    // Push the field configuration in the current loop order
    Push(fieldInfos, { fieldName: fName, label: customLabel });
    
    // Pass the actual feature data to the popup
    attributeValues[fName] = fieldValue;
}

// 4. Return the structured dictionary to the popup
return {
    type: "fields",
    fieldInfos: fieldInfos,
    attributes: attributeValues
};

-Dickie

 

Arcade fine in widget but not in pop-up. EB bug?Arcade fine in widget but not in pop-up. EB bug?

0 Kudos
2 Replies
Ke_Xu
by Esri Regular Contributor
Esri Regular Contributor

Hi @DickieRigdon,

Could you help share a web map?

 

Thanks,

Ke

0 Kudos
DickieRigdon
Regular Contributor

@Ke_Xu Hi Ke, yes, can you send me a direct message? Thanks