Querying data on the record summary view and passing it to a related action

I have a record with multiple related actions displayed as cards using the a!recordAction field on the record summary view. Currently, when the user clicks on a related action, all of the data for that related action is queried in local variables on page load.

Many of these related actions use the same queries, so if the user clicks on two different related actions, they need to wait for that query to execute each time. The queries can be quite slow, so I am trying to figure out a way to query more data up front before the user goes into a related action so that a) the page load is faster, and b) the same query does not have to be run for each related action.

I tried adding additional fields to the data type of my record, and querying for the additional data I need in the Single Record Source query to populate those fields.

Here is an example of what I tried.  This is a genericized version of the rule that I use on my record to query a single record (the rule is under the "Source" tab of a record, and is called the "Single Record Source" 

a!localVariables(
  local!originalData: rule!querySingleRecordData(id: ri!id),
  local!finalDataWithOtherQueries: 'type!{urn:com:appian:TEST}singleRecordDataType'(
    ID: index(local!originalData, "ID", null),
    NAME: index(local!originalData, "NAME", null),
    DATE: index(local!originalData, "DATE", null),
    QUERY_DATA_FOR_RELATED_ACTIONS_1: rule!queryDataForRelatedActions1(id: ri!id),
    QUERY_DATA_FOR_RELATED_ACTIONS_2: rule!queryDataForRelatedActions3(id: ri!id)
  ),
  local!finalDataWithOtherQueries
)

This does work, as it allows me to pass any data from the single record query to any related action.  However, when the user clicks a the related action, either through a a!recordAction() field or directly on the record summary view, then the Single Record Source query is run multiple times which makes the related action load time slower than if I just left the query in a local variable on page load. Aparently this is expected behavior according to Appian Support.

Any suggestions on how to run multiple queries and then pass the data to different related actions in a performant way would be greatly appreciated.  I am open to not using a related action, or to creative suggestions!

  Discussion posts and replies are publicly visible