+ Start a Discussion
AntonyasLenAntonyasLen 

Deployement error

Hi,

 

i wanted to deploy a part of my work but i waste a few hour and it doesn't work.

I wrote some class who validate my apex code (class and triggers) and everythings is around 80 to 100%.

 

But when my IDE tried to deploy my work i kept got error.

The current one si that

System.DmlException: Insert failed First exception on rowx 0: UNABLE_TO_LOCK_ROW  unable to obtain exclusive access to this record.

 

 

and this error is the same for my test class;

I really to deploy some critrical features but i'm kind a lock.

Anyone can help me?:(

 

 

Best Answer chosen by Admin (Salesforce Developers) 
AntonyasLenAntonyasLen

Thanks for your post.

 

i found a few problem :

 

- First, i merged two triggers, i guess this is kind a helpful .

- Secondly, i was thinking that Salesforce deployment would merge/update every field but it has and exception : - AUTONUMBER -

my field called Opportunity Number was set as OP-{DD}{MM}{YY}-{0000} in my production environment and as B2B-{DD}{MM}{YY}-{0000} in my sandbox.....

You have to check every AUTONUMBER before any deployment .

 

 

Thanks to everybody for your help!!!

 

 

 

 

 

All Answers

s_k_as_k_a

Hi,

 

You can check any approval process are there on quote.

Jerun JoseJerun Jose
This could be related to one of SF's known issues. I remember that a colleague of mine had similar issues because an autonumber field format had been changed.. Weird huh !!. Hope it helps
AntonyasLenAntonyasLen

Hi ,

 

I'm sorry because i accepted as a solution but it didn't fix my problem.

Can you tell me more about the autonumber field issue???

 

I was so happy to get almost 100% to all my class and triggers with my tests but now i'm stuck. (my boss will kill me ahaha)

 

By the way i will check around the auto number one more time but it looks to be an other kind of problem.

 

If someone does have any others idea let us now.

Thanks a lot

 

Sincerely,

 

Antony

AntonyasLenAntonyasLen
/* Create a product */
		Product2 prd2 = new Product2 (Name='Test Product Entry 1',Description='Test Product Entry 1',productCode = 'ABC', isActive = true);
		insert prd2;

As we can see in my code with the error message the problem should be around the Name field but it's not an autonumber , the autonumber is QuoteNumber and between my production and sandbox environment the settings are the same.

 

I need your help. =(

 

AntonyasLenAntonyasLen

i changed something about and object in my classes.

now the error go down a little bit :

 

 

	/* Create an opportunity */
	Opportunity opp1 = new Opportunity (Name='Opp1',StageName='Prospecting', Probability = 10,CloseDate=Date.today(),Pricebook2Id = pbe1.Pricebook2Id, AccountId = acc.id);
	insert opp1;

 

AntonyasLenAntonyasLen

I'm kind a mess i still got the error but if i'm testing my class i got the result below :

 

 

and i already changed every single call to my "autonumber" following this step:

http://techblog.appirio.com/2009/01/work-around-for-sfdc-auto-number.html

 

maybe it can help some guy but i still missing something. :(

Nobody can help?

crop1645crop1645

Here's a few ideas -- I've only had this happen to me once and it was a spurious erorr that went away for good during my next Run All Tests execution

 

 

In PROD, are there multiple triggers on Opportunity that attempt to access some shared resource?

 

  • As you know, if there are >1 trigger for the same event on the same SObject, order of execution is unpredictable and is likely to be different between sandbox and prod
  • Are there other triggers on Opportunity not part of your Eclipse project that attempt to access a shared resource, perhaps recursively calling your trigger that goes after a lock on something already locked?

Does your Production system have resources locked used by your testmethods?  In the case you cited, you are doing inserts so normally this wouldn't be true unless a trigger on Opportunity needs access to something outside of the objects created by testmethods

AntonyasLenAntonyasLen

Thanks for your post.

 

i found a few problem :

 

- First, i merged two triggers, i guess this is kind a helpful .

- Secondly, i was thinking that Salesforce deployment would merge/update every field but it has and exception : - AUTONUMBER -

my field called Opportunity Number was set as OP-{DD}{MM}{YY}-{0000} in my production environment and as B2B-{DD}{MM}{YY}-{0000} in my sandbox.....

You have to check every AUTONUMBER before any deployment .

 

 

Thanks to everybody for your help!!!

 

 

 

 

 

This was selected as the best answer