Select to view content in your preferred language

Attribute Rule Not Triggering When Domain Change/Update

721
4
11-09-2023 06:47 AM
BHK
by
Occasional Contributor

Having a GDB with a Feature Class called `Inspection` and a Domain (InspectStat) with "Yes" and "No" coded values which is assigned to `Is_Inspected` field, I want to enable user to Add Today() date into `Inspect_Date` field  when `Is_Inspected` status change

 

If ($feature.Is_Inspected =='Yes')  {
$feature.Inspect_Date = Today()
}else{
$feature.Inspect_Date = null
}

 

BHK_0-1699540673799.png

I used Calculation immediate rule against the Is_Inspected field and Triggers are Insert and update but when I update the value of Is_Inspected (using domain "Yes" or "No") I am not getting any changes/updates on `Inspect_Date` and it is always null

Tags (1)
0 Kudos
4 Replies
MikeMillerGIS
Esri Frequent Contributor

You need to return the edit, setting it on $feature does not affect the feature

0 Kudos
BHK
by
Occasional Contributor

Thanks for the reply Mike but can you please explain this a little bit better. What do you mean by "You need to return the edit" you mean I should start edit Sesson?

0 Kudos
MikeMillerGIS
Esri Frequent Contributor
0 Kudos
BHK
by
Occasional Contributor

Ok I updated the code to this

If ($feature.Is_Inspected =='Yes')  {
return {
    "result": $feature.Inspect_Date,
    "edit": [{
        "updates": [{
            "Inspect_Date": Today()
        }]
    }]
}
}

 

but still not working

0 Kudos