how to pass array in expression rule

I



I want the result of this expression rule to be in the below format or the highlighted format in the editor. currently I am passing name and comment from one CDT ,now along with this 2 fields  I need to pass the colleagues array with add array with in the colleague array.


I have created other new  CDT for colleague array with id , typeid and addcolleague array in it ,how to call it in the expression rule to get the result in the below format . Please advise



How can I get this result in the below format ,can someone please advise


Expected RESULT

a!toJson

({

"name": "string",
"Comment": "string",

Colleagues:
{

{

"TypeId": 1,
addColleague:

{
"email": "string",
"displayName": "String",
"eFlag": false,
"dFlag": false,
"ProviderID": 2,
"idFromProvider": "string"   }

}

}


})

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to ZAINAB

    The info you're providing is all super unclear.  Please show us:

    1) a screenshot of your actual incoming data (making sure we can understand where a CDT is an array of values or not)
    2) a screenshot of your actual currently-configured expression rule, which you're trying to run and it isn't working

    Just double checking here but do you know how to use a!forEach()?  From the context of the code in your original post expression rule screenshot, it looks like you might not.  I don't see a single reference to "fv!item" though, so it's making me prety doubtful.

    e.g.

    a!map(
      name: "some string from DB",
      comment: "some comment",
      
      translatedInputs: a!forEach(
        ri!testInput,
        a!map(
          email: fv!item.inputEmail,
          dName: fv!item.name,
          eFlag: false(),
          isActive: fv!item.activeFlag
        )
      )
    )

Children