function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mohit KapoorMohit Kapoor 

Why would a piece of code behave differently for System Admin user and a normal profile user

I have a piece of code involving multiple triggers and apex classes. The new result of this functionality is that when some conditions are met mostly stage change values, then a record is created in related bject so that we can have track of changes for specific fields.

The strange thing that is happening is that when as an admin user we do do testing, only one record is created but when we do the testing using a customer, there are 2 records being created which are duplicate. We have no idea why would a piece of code work differently for different profiles.
MagulanDuraipandianMagulanDuraipandian
This may be due to recursive trigger.

http://www.infallibletechie.com/2012/08/recursive-triggers-in-salesforce.html

If this solves your problem, kindly mark it as the best answer.

Regards,
Magulan
http://www.infallibletechie.com
Mohit KapoorMohit Kapoor
I have already tried this. In that case there is no records craeted, the strange thing is that it is working perfectly for System admin so the logic seems to be working fine but when we login from a custom profile there are duplicate records created. I am not really sure how does Salesforce differenciate how apex classes are run whether they are system admin or normal profiles.