Question
Replace queryEntity with queryRecordType
Hi team
Here is my scenario:
I am busy changing my application to get rid of CDTs and use Record Types instead.
As I understand it this means I have to change any query using queryEntity to queryRecordType.
Here is an example of an existing expression:
{
a!entityData(
entity: cons!SAM_DSE_SOFTWARE_STATUS,
data: reject(
fn!isnull,
a!forEach(
items: {
{
uuid: cons!SAM_UUID_SOFTWARE_STATUS_APPROVE,
name: "Approve",
order: 1
},
{
uuid: cons!SAM_UUID_SOFTWARE_STATUS_BACKLIST,
name: "Backlist",
order: 2
},
{
uuid: cons!SAM_UUID_SOFTWARE_STATUS_REJECT,
name: "Reject",
order: 3
},
},
expression: a!localVariables(
local!status: rule!SAM_getSoftwareStatusByUUID(uuid: fv!item.uuid),
if(
isnull(local!status),
'type!{urn:com:appian:types:SAM}SAM_SoftwareStatus'(
id: null,
uuid: fv!item.uuid,
name: fv!item.name,
createdBy: loggedInUser(),
createdOn: now()
),
null
)
)
)
)
)
}
/* the query returns
"
Time 16 ms (View Performance)
Type List of EntityData
Value
FormattedRawExpression
List of EntityData - 1 item
EntityData
entity[Data Store Entity:"0d6bc9c3-8d19-403a-9c2a-213a9c1428d2@94148"](Data Store Entity)
dataList of Variant - 0 items
*/
/*This is the rule referenced by the expression above.
The query returns a status value when a UUID is entered*/
if(
or(isnull(ri!uuid), ri!uuid = ""),
null,
a!localVariables(
local!datasubset: a!queryEntity(
entity: cons!SAM_DSE_SOFTWARE_STATUS,
query: a!query(
logicalExpression: a!queryLogicalExpression(
operator: "AND",
filters: {
a!queryFilter(
field: "uuid",
operator: "=",
value: ri!uuid
)
},
ignoreFiltersWithEmptyValues: true
),
pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 1)
),
fetchTotalCount: false
),
if(
rule!APP_isEmptyArray(local!datasubset.data),
null,
cast(
'type!{urn:com:appian:types:SAM}SAM_SoftwareStatus',
local!datasubset.data
)
)
)
)
I need a few pointers on how to go about changing these using queryRecordType
