Sync lock in micoflow

0
I have a page that calls a microflow twice when it loads. This microflow will determine if an object exists. If it does not exist, create an object. How do I ensure that the object is only created once?
asked
5 answers
3

Do a retrieve of that object first and only create one when no object can be found.

Regards,

Ronald

 

answered
2

I am assuming that you are retrieving the object based on a key attribute e.g. Name=’SpecialName’.
Then you need to make this attribute unique. This will ensure on the database level that no two objects with the same name exist.

answered
0

What is the definition of existing? As you are using a NP entity is must be a reference to ….?

That association must be checked.

On a side note; Why is the microflow called twice at the same open page action?

answered
0

I don’t think you can sync the two objects between two instances of the same microflow.

I think the answer is you’ll need to make sure you only run it once. You can either remove it from the page, or use a different layout without the microflow. 

Going on a limb I’ll assume you must be using some sort of cache-simulating object to show a personalised page to the user which remembers user state during the session. If this is the case then I would suggest instead that you create this object and associate it to the user object when they login (i,e, part of the homepage Mf) and then use a retrieve via association both on your page and layout – hopefully this should ensure that the minimum amount of checks is performed and your object always exists for the current session.

Hope this helps

answered
0

ok, thank everyone, i think  i should change my  implementation

answered