Skip to main content
hemantb0002
Known Participant
February 3, 2023
Solved

Use of ForEach loop in Type! to create multiple CDT elemts

  • February 3, 2023
  • 2 replies
  • 0 views

I am trying to create nested CDT . As part of that one of the CDT needs to be created multiple times. I tried to use forEach in type! but it's throwing me below error. 

Expression evaluation error: Syntax error. Details: Expression evaluation error at function a!localVariables parameter 2 [line 7]: Keyword and non-keyword arguments must not be mixed. Used in: {urn:uk:aviva:appian:eow:createdocumentstoreanddistribute}EOW_coverLetterDetails..

Please find below code for reference,

--

a!localVariables(
local!customerNomineeDetails: {{Forename:"name1",Surname:"surname1",PercentageAmount:"45"},
{Forename:"name2",Surname:"surname2",PercentageAmount:"40"},
{Forename:"name3",Surname:"surname3",PercentageAmount:"45"}

},
local!requestBody: 'type!{urn:uk:aviva:appian:eow:createdocumentstoreanddistribute}EOW_coverLetterDetails'(
xcdBeneficiariesIndicator: "N",
xcdCOBSchemeName: "",
xcdCOBSchemeNumber: "",
xcdCOBProduct: "",
a!forEach(
items: local!customerNomineeDetails,
expression: {
xcdNomineeDetails: 'type!{urn:uk:aviva:appian:eow:createdocumentstoreanddistribute}EOW_nomineeDetails'(
xcdNomineeForename: index(fv!item,"Forename",null),
xcdNomineeSurname: index(fv!item,"Surname",null),
xcdNomineePercentageAmount: index(fv!item,"PercentageAmount",null),
)
}
)
),
local!requestBody
)

Best answer by stefanhelzle0001

I highlighted the location where you missed the fieldname.

BTW, it is not necessary to declare a local variable to make it the "return value" of an expression.

2 replies

stefanhelzle0001
Brainy
February 3, 2023

I highlighted the location where you missed the fieldname.

BTW, it is not necessary to declare a local variable to make it the "return value" of an expression.

hemantb0002
Known Participant
February 10, 2023

Thanks it worked.