Modify Multi Value CDT

I've defined a CDT as a Multi Value. At run time I will have 'n' instances of the object.
During runtime I wish to update a specific field for one of the instances of the object but I'm not seeing how to address the field correctly.

I cant use array[1].field as that's only addressing the first instance. So for example I have at run time the multi Value CDT with the values :

                     Instance1 Instance2 Instance3

Field1(Text)       A                 D              G

Field2(Text)       B                   E             H

Field3(Boolean)  true             false       false

I want to change Instance3 Field 3 from false to true. How to address it because when we modify the value of CDT, it is just updating in the first instance and I am not able to pass the count of the instance

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Hi , emailDetails is a CDT  

    I want to enter headersPresent variable in the instance of emailDetails, when i am trying to do that by the following expression rule it's adding the headersPresent in the first instance of emailDetails.

    For example: As the emailDetails is multi-valued it is coming as -

     [fromId=parul@abc, fromName=, toIds=, ccIds=, bccIds=, subject=, attachments=, body=, latestBody=, hasattachments=, emailid=, hasAutoHeaders=true],[fromId=xyz@comp, fromName=, toIds=, ccIds=, bccIds=, subject=, attachments=, body=, latestBody=, hasattachments=, emailid=, hasAutoHeaders=false]

    It is changing the hasAutoHeaders to true in the first instance as you can see when it should change the hasAutoHeaders to true in the second instance. 

    Please read the above main explanation.

    "

    I cant use array[1].field as that's only addressing the first instance. So for example I have at run time the multi Value CDT with the values :

                         Instance1 Instance2 Instance3

    Field1(Text)       A                 D              G

    Field2(Text)       B                   E             H

    Field3(Boolean)  true             false       false

    I want to change Instance3 Field 3 from false to true

    "

    Hope its clear now. Thanks

  • You try below code .You need to use in updatedictionary in script task

    a!localVariables(
    local!a: {
    {fromId:"parul@abc", fromName:"test", toIds:1, ccIds:23, bccIds:2, subject:"sd", attachments:1, body:12, latestBody:12, hasattachments:12, emailid:2, hasAutoHeaders:true},
    {fromId:"xyz@comp", fromName:"test", toIds:1, ccIds:2, bccIds:3, subject:"sd", attachments:2, body:1, latestBody:1, hasattachments:21, emailid:12, hasAutoHeaders:false}

    },
    local!b:true,
    a!forEach(
    items: local!a,
    expression: updatedictionary(
    fv!item,
    {hasAutoHeaders: local!b}
    )
    )
    )