Continuing on the Business Service simulator post, I will discuss a problem which I faced while simulating the business service. You might also face similar problem and it is not that easy to find.
While simulating the business service kept failing and I could not see any reason for which it should have failed. As it was client side business service I had to do the traditional approach of doing RaiseErrorText in different lines of code to see where it was failing.
After initial debugging I came to know that a SetFieldValue statement was resulting in the error. But instead of simulating if I let the business service run according to normal functionality (trigger it through click of button) I didn’t face that error.
That is when it stuck me that we had setup a Runtime Event to trigger that functionality. Now when I was simulating my Business Service the runtime event was also firing which resulted in the invocation of business service again hence the conflict and failure of BS.
There can be two things you can do.
- Change the code so that runtime events don’t fire
- Deactivate the runtime events.
I followed the second approach and deactivated the runtime events in order to proceed, after deactivating the BS starting working just fine
I was able to conclude about the problem because I knew the functionality well but for some beginners it might be difficult to deduce that. It doesn’t even give any indication or hint in the error message that it is failing due to conflict with runtime events.
So the moral of the post is
If you are simulating a business service and it is failing without any reason make sure it is not triggering any runtime events.