Skip to main content
August 24, 2021
Question

Difference in Write to Multiple Data Store entity and Write to Data Store entity?

  • August 24, 2021
  • 14 replies
  • 0 views

Difference in Write to Multiple Data Store entity and Write to Data Store entity?  When we need to use the multiple data store entity?

14 replies

stefanhelzle0001
August 24, 2021

I think the name already implies the use cases. If you want to write to multiple entities/tables at once, go with the multiple. To write one or more items to a single entity/table, take the other.

hemalathak803
August 24, 2021

Hi,

When you want to write/update multiple entities that belong to the same data store within a single database transaction, Multiple datastore entities will be useful. Whereas write to data store entity will write/update only one entity at a time.

Please find more details from the documentation

https://docs.appian.com/suite/help/21.2/Write_to_Multiple_Data_Store_Entities_Smart_Service.html

https://docs.appian.com/suite/help/21.2/Write_to_Data_Store_Entity_Smart_Service.html

Hope this helps!!

Thanks,

Hema.

August 24, 2021

Thanks Hema for the response.

Is there any other difference apart from this?

And Why it is not recommended to use multiple data store entity smart service?

stefanhelzle0001
August 24, 2021

Why are you asking? Who says that the multiple is not recommended?

It is a good idea to use the best matching tool for a given task.

davel001150
August 24, 2021

The difference is entirely about transactions.

Say you're doing banking with Appian, and you have a process that writes to Mr. Johnson's account that 3000 dollars are removed, then writes to Mr. Smith's account that 3000 dollars are added, and then writes to the Audit History that 3000 dollars were transferred from Mr. Johnson to Mr. Smith.

If you do those one at a time, then it should work most of the time.  However, it's especially bad if something breaks.  What if the money is removed from Mr. Johnson's account successfully, but then there's a "Connection Closed Exception" and the money isn't deposited in Mr. Smith's account.  Then say the process retries 10 times without success then skips that node and writes the audit history just fine.

Mr. Smith is going to want to know where his money is.  If you try it again, Mr. Johnson is going to want to know why 3000 dollars were deducted from his account twice.  And when you get audited, you're going to have a massive headache figuring out the audit history.

OR, you do it all at once in one node.  You deduct the money, deposit the money, and record the transaction in one step.  If it fails, you don't commit anything.  You roll back all of it and start again from the beginning.  No money changes hands completely until all the steps go off without a hitch.

So that's what it's for.  When the multiple writes constitute a single transaction, you should use Multiple Write to Datastore.  If you don't want anything going unless it all goes, use that.  If the writes are fairly unrelated, you can use a few Write to Datastore nodes back-to-back.  I personally find the latter much easier to configure, and so potentially much more maintainable and less buggy, but when you need transactions you need transactions.

August 24, 2021

Thanks David for indetail explanation.