II 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 adviseHow can I get this result in the below format ,can someone please adviseExpected RESULTa!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
You can add a rule input of that M_addcollegue type and make it a list.
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 addcolleaguecan you please help
Mike Schmitt :can you please look at this
I have updated the above comment with required details
Is the code you shared your actual code? This will hardly work.
In line 3, why do you wrap ri!name in quotes?
In line 7, why do you wrap the field name in quotes?
In line 13, what is "fvfv!ite!item.requestorname"?
And I have the same question as Mike Schmitt has. What is the input, and what is the intended output?
I want this body as input to an integration .In the existing process model we are passing body only with name and comment as an input to an integration via scriptask (input as expressionrule )
I need to get output of expressionrule as belowa!toJson({ "name": " some string from db ", "Comment": "some string from db", CAC:{ { "TypeId": 1, /*Value is always 1*/ add: { "email": "some string from data ", "dName" : "some string from data", "Provider" : "some string from data", "eFlag": false, "dFlag": false, "ID": 2 } } }})name ,comment,email,provider and dname values are present in one CDT . I'm trying build an array structure and get email and dname from main CDT where existing values are present.1. Have already existing CDT I..e Main CDT ---name ,comment,email,dname and few other fields and now i have added CAC Cdt in this mail CDT as an array2. Created One CDT for CAC with fields type ID and add CDT3. In ADD CDT , added fields email,name,provider,eflag ,dflag Can you please help because of incorrect looping server got crashes due to memoryheap
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 ) ) )
(and of course that entire thing can just be wrapped in a!toJson once you know it's working...)
Mike Schmitt : I have one table in DB and created a CDT created from the same . In the CDT I want to add a nested CDT , will it impact db of that table if I add nested cdt in the CDT?
I don't recommend ever using nested CDTs, personally.
a!toJson( { name: "NAME",Comment: "comments",CAC: { a!map(TypeId: 1, addcolleague: a!map( email: "requestorEmail", displayname:"requestorName", deletedFlag: false, identityProviderID: 2, idFromProvider:"Value"
) ) } } )I'm getting output as "{"name":"NAME", Comment":"comments",
"CAC:[
{"TypeId":1,"addcolleague":{"email":"requestorEmail","displayname":"requestorName",deletedFlag":false,"identityProviderID":2,
"idFromProvider":"sagdoi"}}]}"Mike Schmitt :Instead of [ ] , I need { } ,can you please help ,rest everything is expected.I'm passing this expressinrule output as an input to integration ,it says [ ] is invalid. can you please help
ZAINAB said:Instead of [ ] , I need { }
The [ ] here are because the structure of your code indicates that the "CAC" property will contain an array, since you use curly brackets and then a!map(). If it's just supposed to contain a single sub-dictionary then you don't need to double-indicate this - meaning you could just pass in an a!map() call, OR the curly brackets - when you use both, it assumes that the property contains an array of (one of) that map.
This is what I get when I comment out just one of those: