Hi Josh,
Thanks for your answer. Below you can see the section of the code where the assignment is done and the returned dictionary is defined. Before this section the code is just finding the closest source feature, which is not related to the problem.
As you can see, I'm updating multiple fields, hence the used of the dictionary. The IF statement is the workaround that I mentioned in the third paragraph of my original question.
Below you can see images with the field view in ArcGIS Pro for the source class and the target class.
// Extract fuse attributes from closest source feature
var fuse_addpowerrating = closestf['Bayonet_fuse_rated_amp'] // This is the fuse rated current
var fuse_installdate = closestf['InstallationDate'] // Fuse installation date
var fuse_inservice_date = closestf['TapDate'] // Fuse inservice date
var phasesnormal = transf_phase // Domain assign to field
var phasescurrent = transf_phase // Domain assign to field
var phasessummer = transf_phase // Domain assign to field
var phaseswinter = transf_phase // Domain assign to field
if (IsEmpty(fuse_installdate) || IsEmpty(fuse_inservice_date) ) {
fuse_inservice_date = null
fuse_installdate = null
}
// Return dictionary with the data to transfer to the target feature
return {
'result': field_value,
'edit':[
{
//updates the fuse feature attributes
'className': 'UN_MODEL_V34.MODEL_V34.ElectricDevice',
'updates': [{
'globalID': $feature.globalID,
'attributes': {
'phasesnormal': phasesnormal,
'phasescurrent': phasescurrent,
'phasessummer': phasessummer,
'phaseswinter': phaseswinter,
'addpowerrating': fuse_addpowerrating,
'installdate': fuse_installdate,
'inservicedate': fuse_inservice_date,
//'model': fuse_model
}
}]
}
]
}
}
Source Feature Date Fields
Target Feature Date Fields