Update a CDT from multiple sources

 I have a CDT of several fields. The majority of fields get populated via a rule. However I also need to update one of the fields with a value from a text input. To do this I have the following :

 

a!textfield(
value:ri!test
saveInto:{

     ri!test,
     a!save(target:ri!myCDT,
                value:rule!getData),
    a!save(target:ri!myCDT.FIELD4,
               value:"DATA1)
)

However when I enter text in this field, and tab off (thus executing the save) I'm getting an error

 

Definition: Expression evaluation error in rule 'TEST' : An error occurred while executing a save: java.lang.IllegalArgumentException: Invalid index: Cannot index property 'fIELD4' into type List of Number (Integer)

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    Hi Paul,

    You can do this by type casting all the values to CDT. In the below example i have two local variables and they can be updated by either rule or input. Once you have all the local variables updated with the values you can type cast it to CDT as i have done for CDT MNITest.

    load(
    local!name:"Nitesh",
    local!address:"Newyork",
    local!output:
    'type!{urn:com:appian:types:pdm}MNITest'(
    name: local!name,
    address: local!address

    ),

    local!output
    )
Reply
  • 0
    Certified Lead Developer
    Hi Paul,

    You can do this by type casting all the values to CDT. In the below example i have two local variables and they can be updated by either rule or input. Once you have all the local variables updated with the values you can type cast it to CDT as i have done for CDT MNITest.

    load(
    local!name:"Nitesh",
    local!address:"Newyork",
    local!output:
    'type!{urn:com:appian:types:pdm}MNITest'(
    name: local!name,
    address: local!address

    ),

    local!output
    )
Children
No Data