Any idea on how to cast cdt to record type
Discussion posts and replies are publicly visible
You can do it like this
recordType!Student( recordType!Student.fields.name: local!student.name )
Just make sure to replace recordType! with your actual record properties.
Using cast() function.
cast( 'recordType!{xx-xx-xx-xx-xxx}Employee', 'type!{urn:com:appian:types:HROB}Employee_CDT'( id: 1, name: "Abc", department: "IT", salary: 123, age: 25 ) )
Cast will only work if the keys (field names) of the CDT and the record is exactly the same.
No need to have the same structure. The cast function will consider all the matching fields and do the conversion. The uncommon fields will be initialize with null.
Ex.
Exactly what I said :)
Never said about having the same structure. I said about keys should be exactly the same.
Got you, thanks!
Just trying to share more details so to help the other person.