Data Service: Query Entity Records Best Practice

Hi, I’m using Data Service for my Cloud Automation. What is the best practice to call for entity records for my process; is it to store them in the Config dictionary in the Init state or just use Query Entity Records every time I need to use it? Where does the entity is stored when the process is triggered; is it locally or is it stay in Data Service?

It really depends on what you are trying to achieve with your process and how you are using the entities.

The typical suggestion will be to use Query activity in the process to fetch the latest data from entities when you run a process. Once the data is fetched, it remains in your process memory as variables until either the process ends or the variable is removed from scope. That’s why, any changes you do to the entity data has to be written back to Data Service using the Update, Create or Delete activities before the process exits.

Coming to the question whether you should just pull the data once per process or multiple times in a process, it really depends on the data and what you are doing with it.

  • If the data is something that doesn’t change often and it is ok if you use some stale version during a process execution (things like configuration or master data), you can fetch once at start of the process and then just use it till the process exits and new version will be fetched on the next run.
  • If the data is dynamic and you need the latest version always, the suggestion is to have the Query activity immediately before you act on the data and then write it back immediately to Data Service. If the data is needed again later in process, then it should be fetched again using Query.

I hope this explanation gives you some input and ideas on your usage of entities and Data Service.


Thanks @ankit.saraf, this makes sense.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.