Skip to main content
May 23, 2024
Question

how to pass array in expression rule

  • May 23, 2024
  • 16 replies
  • 0 views

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"   }

}

}


})

    16 replies

    stefanhelzle0001
    May 23, 2024

    You can add a rule input of that M_addcollegue type and make it a list.

    sabat0002Author
    May 23, 2024




    No output is not in the expected format 

    name and comment i have those values  in1st CDT i.e TEST , I have displayname ,email,idprovider values also in 1st CDT but I need those values in array for addcolleague

    can you please help 

    stefanhelzle0001
    May 23, 2024

    Dictionaries are lists of field-value pairs. In that line with the foreach, I am missing a field name.

    I would expect something like this:

    fieldName: a!forEach(