When we try to pass values queried through entity based expression rule to value field field of record type query filter it fails. How to make it working?
I have checked in both cases for querying data same set of list of integer is returned but it fails for query entity
Discussion posts and replies are publicly visible
You can cast CDT data to the record type.
Still facing the error Could not cast from Number (Integer) to Record Field. Details: CastInvalidCould not cast from Number (Integer) to Record Field. Details: CastInvalid.
it is of form-
(
cast ( typeof(recordtype!parentrecord.record1.record2.fields.value),
list of integer from query entity
)
Hi , Can you share the code snippet here?Also how are you referencing the record fields?
What do you want to achieve? Cast a CDT to a record type, or cast a list of integers to .... what?
Sorry can't share the code.
Multiple referenced record with each other on basis of some foreign keys.
recordtype!parentrecord.record1.record2.fields.value)
in a data query of record type inside it's query filter we are passing a set of integer values retrived from query entity but it did not work so tried to pass it by casting into record but cast invalid error comes up
cast a list of integers to this kind of record field - recordtype!parentrecord.relationships.record1.relationships.record2.fields.value
Did you try tointeger()?
Still not working same error Could not cast from Record Field to Number (Integer). Details: CastInvalidCould not cast from Record Field to Number (Integer). Details: CastInvalid
Hi , if you need to cast a list to record , you need to use below steps. The issue is you need to explicitly define the id value which has to be casted into record type via your CDT constructor. Both record field and your CDT field should be of same type. Remember to use () after record name , ex --record!case()
Use a loop on all your IDs.
a!foreach(items: local!generatedId (list of integers),
expression:{
cast(typeof(recordname)(),
type!yourcdt(
id: fv!item // use fv!item for single ID value
))
}
Thanks