Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
7 replies
Subscribers
7 subscribers
Views
3302 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Hi, We have list of entities fetched from a!queryEntity() part of Rule: rul
ganeshl
over 8 years ago
Hi,
We have list of entities fetched from a!queryEntity() part of Rule: rule!CP_getRequiredDocsByBC. This entity has nested CDT(Entity). When we add, new record into the list, nested CDT from newly added record is treated as Text and we get following error.
Strangely, when we have same CDT list created on the fly see, commented code. It works fine.
ERROR: Could not display interface. Please check definition and inputs.
Interface Definition: Expression evaluation error at function a!formLayout [line 45]: Invalid index: Cannot index property 'BenefitType' of type Text into type List of Variant
Code:
load(
local!docs: rule!CP_getRequiredDocsByBC(
"963"
),
/*local!docs: {type!CP_RequiredDocuments(
ID: 5,
BenefitType: type!CP_BenefitType(
ID: 55
)
)
},*/a!formLayout(
label: "Lorem Ipsum",
instructions: "Lorem Ipsum",
firstColumnContents: {
a!textField(
label: "Lorem Ipsum",...
OriginalPostID-153148
OriginalPostID-153148
Discussion posts and replies are publicly visible
0
ganeshl
over 8 years ago
...
readOnly: true,
value: local!docs.BenefitType.ID
),
a!linkField(
labelPosition: "COLLAPSED",
links: a!dynamicLink(
label: "Add Link",
value: "High",
saveInto: {
a!save(
local!docs,
append(
local!docs,
type!CP_RequiredDocuments(
ID: 6,
BenefitType: type!CP_BenefitType(
ID: 66
)
)
)
)
}
)
)
},
secondColumnContents: {
/* Add components here for a two-column form */
},
buttons: a!buttonLayout(
primaryButtons: {
a!buttonWidgetSubmit(
label: "Add",
style: "PRIMARY"
)
},
secondaryButtons: {
a!buttonWidgetSubmit(
label: "Cancel",
skipValidation: true,
value: true,
saveIn...
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ganeshl
over 8 years ago
...to: ri!cancel
)
}
)
)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ganeshl
over 8 years ago
Only relevant code is here;
load(
local!docs: rule!CP_getRequiredDocsByBC(
"963"
),
/*local!docs: {type!CP_RequiredDocuments(
ID: 5,
BenefitType: type!CP_BenefitType(
ID: 55
)
)
},*/a!formLayout(
label: "Lorem Ipsum",
instructions: "Lorem Ipsum",
firstColumnContents: {
a!textField(
label: "Lorem Ipsum",
readOnly: true,
value: local!docs.BenefitType.ID
),
a!linkField(
labelPosition: "COLLAPSED",
links: a!dynamicLink(
label: "Add Link",
value: "High",
saveInto: {
a!save(
local!docs,
append(
local!docs,
type!CP_RequiredDocuments(
ID: 6,
BenefitType: type!CP_BenefitType(
ID: 66
)
)
)
)
}
)
)
}
)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Conor Cahill
Certified Lead Developer
over 8 years ago
are you getting the data field from the a!queryEntity() result? That always returns a datasubset.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ganeshl
over 8 years ago
yes, inside the rule I am doing a!queryEntity().data. And, I am getting the list back properly. The question is only about when we add new CDT it treats newly nested CDT's child cdt as Text even those it is proper CDT create via type!CP_BenefitType().
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ganeshl
over 8 years ago
For benefit of all, we had to use cast() function to get it working.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Mike James
Certified Lead Developer
over 8 years ago
Nice forum etiquette! Thanks for returning to post the solution, it helped me!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel