Hi All,
I am facing an issue while executing an AutoNumber CRM plugin on an entity (say, Service entity). The following are the CRM plugin details:
Purpose of Plugin: Create an auto generate sequence number
Event: Pre-create
Mode: Synchronous
There are two ways of creating the records in the Service entity.
Batch Process (exe): The batch process is executing on every 15-30 mins and fetching the data from another system / application and dump the data into CRM. In this case, CRM plugin is executed perfectly fine and records are created.
Web Service (API): In this case we have exposed the API and we have another application which calling this API and push the data into CRM. Here the records are not creating and CRM plugin throwing an error "An unexpected error has occurred, please notify your system administrator. Error token: 93a2ee24078"
Can anyone please provide their inputs why the CRM plugin throwing an error when the records are created through Web Services (API)?
--
Thanks and Regards
Sandeep
*This post is locked for comments
Hi Alex,
Shared the part of the code via an email.
--
Thanks and Regards
Sandeep
Hi Sandeep,
If you post the code, maybe we'll see something.. hard to say, though. It's just that from the description you posted originally it looks like a problem on the plugin side which only happens occasionally, and synchronization is the usual problem then.
On the other hand, did you try disabling the plugin(unless that's not possible because of the other logic) Will the error still happen if you do?
Hi Alex,
I have gone through the article.
We have implemented our logic in almost the same manner as mentioned in the article, here we are using one single entity for generating the sequence number and also have the locking mechanism in place in plugin.
Another important point here is that we have to execute our plugin synchronously as we have to send the newly generated auto number to the other application as a response.
--
Thanks and Regards
Sandeep
Hi Sandeep,
have a look at this article:
Basically, the point is that you may need some locking mechanism.. Since plugins are running in transactions, you can use that.. For example, if you try to update exactly the same record/field from 2 different transactions, one of them will have to wait till the first one has finished (so, if your autonumbering kicks in in the pre-create.. no two auto-numbering plugins will run at the "same" time once you implement that approach)
Hi Gopalan,
No, there is no code changes in the web service or plugins. As I mentioned that it was working fine for the batch process earlier, but when I am executing the same plugin for the web service API then in that case this plugin throwing an error.
--
Thanks and Regards
Sandeep
Hi Alex,
Can you please provide more inputs on your statement "add synchronization by updating some dedicated record at the beginning of the auto numbering plugin"? Could you please provide any example / code to do this?
--
Thanks and Regards
Sandeep
I am pretty sure it's the plugin that's causing this. For the autonumbering plugins, its, usually, some sort of deadlock.. your batch process might be doing everything sequentially, and that other app might be using threads.. it often helps to add synchronization by updating some dedicated record at the beginning of the auto numbering plugin - since it's the same record all the time, only one transaction can get to it. Which basically makes your plugin sequential no matter what
Hi
Was this working without any issue before?
Any code changes in Web Service or Plugins?
Please provide the screenshot as well.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156