Skip to main content
francescag5899
April 15, 2026
Question

Unable to take properties into a forEach() for a fv!item

  • April 15, 2026
  • 11 replies
  • 0 views

I'm having some issues understanding how to use indexes into a forEach taking the items from a expression rule.

I'll explain my problem a little bit deeper; I'm trying to get some of the properties from the RecordType "Anomalie", i would like to use the expression rule with get me all of the anomalies linked to a specific pension by the pensionid, and get the description, the name, the action related to it. But i'm having trubles indexing these properties once I call the expression rule. When I try to use fv!item.description into the description rich text field it seems like it doesn't recognize the object as a record type. 

I pasted the code snippet for the forEach i have in the interface, does anyone had some similar issues and may give me suggestions on what to try to make it work? Thank you so much!!

(my finished product should be a card for each anomaly found linked to the record Beneficiary, each with their description, name and related action)

a!forEach(items: rule!SRI_AnomaliePensione(pensioneId: ri!record['recordType!SRI beneficiario.relationships.pensione.fields.chiavePensioneCorrente']),
expression: a!cardLayout(
contents: {
a!richTextDisplayField(
labelPosition: "COLLAPSED",
value: {
a!richTextItem(text: { "Anomalia" }, style: { "STRONG" })
}
),
a!richTextDisplayField(
labelPosition: "COLLAPSED",
value: { "Descrizione anomalia" } */should be fv!item.description/*
),

a!sideBySideLayout(
items: {
a!sideBySideItem(
item: a!tagField(
labelPosition: "COLLAPSED",
tags: {
a!tagItem(
text: "Aperta", */should be fv!item.status/*
backgroundColor: "#cc0000"
)
}
)
),
a!sideBySideItem(
item: a!buttonArrayLayout(
buttons: {
a!buttonWidget(
label: "Sana anomalia", */should be the recordActionField "sana anomalia" with identifie: fv!identifier /*
size: "SMALL",
width: "MINIMIZE",
style: "SOLID"
)
},
align: "END",
marginBelow: "NONE"
)
)
}
)
},
height: "AUTO",
style: "#efefef",
shape: "SEMI_ROUNDED",
marginBelow: "STANDARD",
borderColor: "#1155cc",
showShadow: true
))

11 replies

harshas2775
April 15, 2026

Instead of using  fv!item.description use record type reference for the field description. E.g. fv!item['recordType!Anomalie.fields.description']

If the rule rule!SRI_AnomaliePensione(pensioneId: ri!record['recordType!SRI beneficiario.relationships.pensione.fields.chiavePensioneCorrente']) returnds a record type then fv!item need to have proper record type reference for the field involved, dot (.) notation simply wont work as it is not a dictionary, cdt or list of vairant. 

francescag5899
April 15, 2026

Thank you so much for the answer!

I tried doing as you told me but received error like my RT anomaly.description is not of type text but Record Field, like it's not getting the value filtered by the pensionID.

My expression rule (when giving a value to the rule input "pensionID: 7839158") returns a List of SRI anomaliepensione - 3 items. 

Do you think i'm referencing the right object or is the construct wrong? How would you advise to build the card component for the needs explained? 

Thank you so much for your help!!

harshas2775
April 15, 2026

yes you need to type the record type name then fields then the field name. so it looks like a record field rather than fv!item.description. 

 fv!item[recordType!Anomalie.fields.description]

In Interface it would look something like below with the record type icon. 

So first configure the desctiption field properly. SImilar you need to do for 'status' as well. If you have 3 items in the record list, 3 cards should be visible as per your code.

yashwantha0914
April 15, 2026

Hi Francescag5899, 

What is the data type of the data that you are passing to foreach items?
you need to index with the record type fields if the fv!item is of record type

Refer to this:

stefanhelzle0001
April 15, 2026
shubhama926776
April 15, 2026

[mention:8a39478a8c6d4a149bdd08b1f183ba29:e9ed411860ed4f2ba0265705b8793d05] 

The rule returns a DataSubset, not a plain list.
Add .data after your rule call to get the actual rows(rule!SRI_AnomaliePensione(...).data).
Use bracket notation fv!item[recordType!...] instead of fv!item.description.

mikes0011
Brainy
April 15, 2026
The rule returns a DataSubset, not a plain list.

FYI, a!forEach() can inherently handle a simple array OR a dataSubset, and the properties are accessed via fv!item inside the forEach loops just the same.

EDIT: it appears this is somewhat outdated info at least in the case of recordtype data queries - the ".data" is needed either in the "items" or "expression" parameter of the a!forEach() in order for the properties to index properly.

To confirm, what I described above is how CDT / data store style queried DataSubsets work in a!forEach(), apparently there's an inconsistency with the behavior of a dataSubset that contains recordtype data...

Final note: I just remembered, the cause of this is because queryRecordType() returns a map, not a dataSubset (it's just dataSubset-shaped).  This causes all sorts of "fun" issues [emoticon:9d27520b879541edb4dc3688e695ae44]

francescag5899
April 15, 2026

Thank you for answering!

One question: if this is the case what is wrong that i can't see or reference the properties of the dataSubset from the fv!item inside the forEach? 

As people suggested with the index( fv!item,'recordType!{SRI anomaliepensione.fields.description'," "), the forEach is working, is there another way to avoid using the index function?