• Antigoni
  • NEWBIE
  • 10 Points
  • Member since 2013
  • Salesforce Developer
  • Financial Times

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
Hello there,

In an effort to try and utilize the new summer 14' changes, I am creating a test pricebook2 in my test class. I am including the code below:

      testProduct1 = FT_TestObjects.getCreateTestProduct();
      testPricebook1 = new Pricebook2(Name='Test Pricebook', IsActive=true);
      insert testPricebook1;
      testPricebook1 = [Select Id, Name From Pricebook2 Where Name =: 'Test Pricebook'];
     
      PricebookEntry standardPricebook = new PricebookEntry(Pricebook2Id=Test.getStandardPricebookId(), Product2Id=testProduct1.Id, UnitPrice=10.00, IsActive=true, UseStandardPrice=false);
      insert standardPricebook;

      testPricebookEntry = FT_TestObjects.getCreateTestPricebookEntry(testProduct1.id, testPricebook1.id);



So far all good. However when I try to do the same from another class, and run the two test classes at the same time I get an error message: "UNABLE_TO_LOCK_ROW" , exception thrown on the line I am inserting the standardPricebook.

If I comment out the lines where I am creating + inserting the standard pricebook I get the following error mesage: System.DmlException: Insert failed. First exception on row 0; first error: STANDARD_PRICE_NOT_DEFINED, No standard price defined for this product: []

Is there anyway that I can work around that, e.g. create a test standard pricebook2 ?




        
    

Hello there,

We've been having a problem in out org lately, getting an exception from test classes that are retrieving via SOQL the standard salesforce pricebook.

The exception is 'UNABLE TO LOCK ROW', for more info see the following link: http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_concepts_core_data_objects.htm

Also the exception is thrown on inserting a pricebookentry, which is using the standard pricebook ( child to parent ).

After a lot of research we realised that deleting a lot of opportunities, which are also children to pricebook, is creating the locking problem with the classes.

We have indications that Salesforce is locking the standard salesforce pricebook record, as part of the 'data skew problem' : https://developer.salesforce.com/blogs/engineering/2013/04/managing-lookup-skew-to-avoid-record-lock-exceptions.html?language=en

We also have indications that Salesforce might be locking an entire table (pricebookEntry or Pricebook), as part of sync with Zuora from which the opps deletion is happening.

It is unclear to me, which of the 2 is happening, so my question is, is Salesforce able to lock an entire sObject table, or can it just lock a single row ?

 

Thanks in advance !

Hello there,

I am getting the following very peculiar and non-obvious error:

Using Springsource 3.3.0 and Force.com iDE v28, when I am trying to save to server the Case.object, the saving action is completed without errors, but what I am getting back is the following xm file, which is extremely different that the initial I was trying to save:

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata"/>

The initial xml file I was trying to save is a regular metadata xml file describing all fields, record types... e.t.c. of the Case object.
Of course nothing is changed in the organisation to which I am trying to save the object.



Can someone please help me with that, cause I have absolutely on idea what to do and it is really urgent.
Thanks in advance.




Hello there,

I am getting the following very peculiar and non-obvious error:

Using Springsource 3.3.0 and Force.com iDE v28, when I am trying to save to server the Case.object, the saving action is completed without errors, but what I am getting back is the following xm file, which is extremely different that the initial I was trying to save:

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata"/>

The initial xml file I was trying to save is a regular metadata xml file describing all fields, record types... e.t.c. of the Case object.
Of course nothing is changed in the organisation to which I am trying to save the object.



Can someone please help me with that, cause I have absolutely on idea what to do and it is really urgent.
Thanks in advance.