Hi,
As, I'm trying to fetch the document name using ruleinput(CDT linked). But i'm getting the following error
ERROR:
The passed parameter(s) are of the wrong type. Received the type List of Variant.
I have achieved this by calling the same data from an Expression rule - HD_getEmpDetailsbyId (Commented in the below code) but i need to get the document name when calling from the Rule Input
CODE:
a!localVariables( local!getempdetails: rule!HD_getEmpDetailsbyId( id: ri!id ).data, local!emp: ri!employee, a!sectionLayout( label: { /*"" & document(local!emp.resume,"name") ,*/ "" & document(local!getempdetails.resume,"name") },
Thanks in advance
Discussion posts and replies are publicly visible
First I would try wrapping the values in todocument() to get past the type mismatch, and go from there:
label: { /*"" & document(todocument(local!emp.resume),"name") ,*/ "" & document(todocument(local!getempdetails.resume),"name") },
Hi Chris,
no luck, Still I'm getting the same error.
Please find the below snippet.
If I am reading the error that you posted correctly, it is because the local is an array (even if only one value is in it). You need to look at putting this in a looping function or point to a specific index. Hope that helps
Alternately, if local!getEmpDetails is supposed to only contain one entry, you would want to take the first index of the query results, such as by adding [1] after .data, or by calling the index() function on it. Another way that'd work (and let you skip type casting the document id, to boot) would be to cast the query result to your CDT type, using cast().
Examples:
/* variant 1 */ a!localVariables( /* assumes there will always be (at least) one result; will break if there are 0 results */ local!getempdetails: rule!HD_getEmpDetailsbyId( id: ri!id ).data[1], a!sectionLayout( label: document(tointeger(local!getempdetails.resume), "name") ) )
/* variant 2 */ a!localVariables( /* safe against 0 query results. slightly increased code complexity. */ local!getempdetails: index( rule!HD_getEmpDetailsbyId( id: ri!id ).data, 1, {} ), a!sectionLayout( label: document(tointeger(local!getempdetails.resume), "name") ) )
/* variant 3 */ a!localVariables( /* also safe against 0 query results. no need to type cast later. */ local!getEmpDetails: cast( 'type!{urn:com:appian:types:EXAMPLE}YourCDTGoesHere', rule!HD_getEmpDetailsbyId( id: ri!id ).data ), a!sectionLayout( label: document(local!getempdetails.resume, "name") ) )
Perfect!!...Thank you so much Mike...
Thank you Christine