Hello,
I have a problem that i wrote a plugin that fires on update an entity field.
This plugin has a part of the code that reads a numerical value from another entity, set it to a field in the entity, then increments it by 1 in its entity.
So that the next plugin fires will read the incremented value from that entity, and so on.
But, on updating multiple records at time, the plugin fires at the same time, and some of records took the same numerical value and it seems "from my opinion" the incrementing process and updating the field in the other entity is slowly compared to the generating updates of records.
I would like to lock the part of code that of reading and updating/incrementing that value, using something like (Lock, Semaphore, Mutex) .
How can i achieve this please ?
I'm using CRM online by the way.
Thank you vey much.