Skip to main content
December 9, 2022
Solved

How to get individual records based on record ID in a rule?

  • December 9, 2022
  • 4 replies
  • 0 views

I'm trying to manually create a related action for a record type (the auto generator didn't work). I need to create an expression rule that returns an individual record based on the record ID (according to the documentation), but there doesn't seem to be any documentation on how to actually do this. I've posted what I have currently that is not working, could someone let me know what I'm doing wrong?

Thanks in advance!

Expression rule:

a!queryRecordType(
  recordType: 'recordType!{5e8d63c0-430d-4636-9dfe-e5e4c67aefc5}SH survey data',
  fields: {},
  pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 1
  )
).data[ri!identifier]

Context field in Related Acton configuration:

{
  record: rule!SH_getSurveyRecordById(rv!identifier) /* SH survey data */
}

    Best answer by mikes0011

    As far as I know you'd need to use a!queryFilter() within a!queryRecordType() just like you'd use in a!queryEntity.  Your filter would identify the PKID field, operator of "=", and value of ri!identifier.  If there's any more quick/direct/magic-hand-wavey way of doing this via a!queryRecordType() then i'm unaware of it.

    The documentation for a!queryRecordType() goes through filtering pretty in-depth, FWIW.

    4 replies

    mikes0011
    mikes0011Answer
    Brainy
    December 9, 2022

    As far as I know you'd need to use a!queryFilter() within a!queryRecordType() just like you'd use in a!queryEntity.  Your filter would identify the PKID field, operator of "=", and value of ri!identifier.  If there's any more quick/direct/magic-hand-wavey way of doing this via a!queryRecordType() then i'm unaware of it.

    The documentation for a!queryRecordType() goes through filtering pretty in-depth, FWIW.

    The Expression Guru
    jackf0001Author
    December 9, 2022

    Can't believe I didn't think of that, but that was it. Thanks, Mike!

    jakubf0002
    December 9, 2022

    You can use query entity and cast to your type

    docs.appian.com/.../fnc_system_a_queryentity.html