Unable to add row dynamically .

Hi ,

I have a nested cdt . When i try to add a row dynamically to the grid i am unable to do it . I want it to be save in this format ,--- Details : ABC , CDF   Department : depatment type: CSE , createdby : loggedin user, date:now().

 And here ri!doc - is rule input with any type .

Can anyone help me with it please. Below is the code. Thank you in advance .

a!localVariables(

local!employeesDoc: cast(
'type!{urn:com:appian:types:AA}AA_Vehicaledata',
{
Details: null,
department:{
departmenttype:
createdby:loggedInUser(),
dateCreated:now()
},
}
),



a!formLayout(
label: "Example: Add,Update, or Remove Employee Data",
contents: {
a!gridLayout(

headerCells: {
a!gridLayoutHeaderCell(label: "Name" ),
a!gridLayoutHeaderCell(label: "Department" ),
a!gridLayoutHeaderCell(label: "created by" ),
a!gridLayoutHeaderCell(label: " created date" ),


a!gridLayoutHeaderCell(label: "" )
},

columnConfigs: {
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),

},

rows: a!gridRowLayout(
contents: {


a!fileUploadField(

value: local!employeesDoc.Details,
saveInto: local!employeesDoc.Details,

),
/* For the Department Column*/
a!dropdownField(

placeholder: "-- Select -- ",
choiceLabels: { "Corporate", "Engineering", "Finance", "Human Resources", "Professional Services", "Sales" },
choiceValues: { "Corporate", "Engineering", "Finance", "Human Resources", "Professional Services", "Sales" },
value: local!employeesDoc.department.departmenttype,
saveInto: local!employeesDoc.department.departmenttype,
required:true
),
/* For the Title Column*/
a!textField(

value: loggedInUser(),
readOnly: true,
saveInto: local!employeesDoc.department.createdby,

),
/* For the Phone Number Column*/
a!textField(

value: now(),
saveInto: local!employeesDoc.department.dateCreated
),


},

),

addRowlink: a!dynamicLink(
label: "Add Employee",

value: ri!docu,
saveInto: {
a!save(local!employeesDoc, append(local!employeesDoc, save!value))
}
),
rowHeader: 1
)
},
buttons: a!buttonLayout(
primaryButtons: a!buttonWidget(
label: "Submit",
submit: true
)
)
)
)

  Discussion posts and replies are publicly visible