UpdateCdt( data: any, field: text, value: any ) =with( /* Get the target data type */ local!dataType: runtimetypeof(index(ri!data, ri!field, "")), /* Special handling for date/time types as Appian is not able the decode a date/time from JSON */ local!newValue: if( contains( {7, 9}, local!dataType ), todecimal(ri!value), ri!value ), local!fieldsAndValues: a!fromJson( substitute( a!toJson( /* Use a fancy field name to prevent errors when replacing it in JSON format */ {'#$#&#':local!newValue} ), "#$#&#", ri!field ) ), /* To make sure the returned data is of the correct type, cast it to the incoming type */ cast( runtimetypeof(ri!data), updatecdt(ri!data, local!fieldsAndValues) ) )