Skip to main content

6 replies

harshitb6843
Brainy
Feb 10, 2023 11:03 AM UTC

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. 

abhayd3663
Brainy
Feb 10, 2023 7:34 PM UTC

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
  )
)

harshitb6843
Brainy
Feb 10, 2023 8:04 PM UTC

Cast will only work if the keys (field names) of the CDT and the record is exactly the same. 

abhayd3663
Brainy
Feb 10, 2023 8:24 PM UTC

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.