• Venkat Ramamurthy
  • NEWBIE
  • 5 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Dear Superbadgers,
I'm getting the below error on step 8
"Ensure that product2Trigger and product2Helper are still working as specified in the earlier challenge."
My test cases are passing with needed coverage, however the above error doesn't seem to go away. Any pointers pls?


 
Dear Superbadgers,
I'm getting the below error on step 8
"Ensure that product2Trigger and product2Helper are still working as specified in the earlier challenge."
My test cases are passing with needed coverage, however the above error doesn't seem to go away. Any pointers pls?


 
I've gone through every step successfully but am banging my head against the wall with step 8. I have more than adequate code coverage but continue to get this error message:
User-added image
I have gone back and rewritten OrderTests twice according to the requirements but can't get past this error. Anyone else had any luck with this?

Here's my code for reference:
@isTest (SeeAllData=false)
private class OrderTests {
    
    static void SetupTestData() {
	    TestDataFactory.InsertTestData(5);
    }
 
    @isTest static void OrderExtension_UnitTest() {
        PageReference pageRef = Page.OrderEdit;
        Test.setCurrentPage(pageRef);
        SetupTestData();
        ApexPages.StandardController stdcontroller = new ApexPages.StandardController(TestDataFactory.orders[0]);        
        OrderExtension ext = new OrderExtension(stdcontroller);        
       	System.assertEquals(Constants.DEFAULT_ROWS, ext.orderItemList.size());
        ext.OnFieldChange();
        ext.SelectFamily();
        ext.Save();
        ext.First();
        ext.Next();
        ext.Previous();
        ext.Last();
        ext.GetHasPrevious();
        ext.GetHasNext();
        ext.GetTotalPages();
        ext.GetPageNumber();
        List<SelectOption> options = ext.GetFamilyOptions();
    }
    
@isTest
public static void OrderUpdate_UnitTest(){
    setupTestData();
    
   
    Test.startTest();
    
    List<Order> orders = TestDataFactory.orders;
    for (Order o : orders){
        o.Status = Constants.ACTIVATED_ORDER_STATUS;
    }
    List<Product2> oldProducts = TestDataFactory.products;
    Set<Id> productIds = new Set<Id>();
    for (Product2 oldProd : oldProducts){
        productIds.add(oldProd.Id);
    }
    oldProducts = [SELECT Id, Quantity_Ordered__c FROM Product2 WHERE ID IN :productIds];
    Map<Id, Integer> quantities = new Map<Id, Integer>();
    for (OrderItem oi : TestDataFactory.orderItems){
        Integer quantity = 0;
        List<PricebookEntry> pricebookentries = TestDataFactory.pbes;
        for (PricebookEntry pbe : pricebookentries){
            if (oi.PricebookEntryId == pbe.Id){                
                if (quantities.containsKey(pbe.Product2Id)){
                    quantity = quantities.get(pbe.Product2Id);
                }
                quantity += (Integer)oi.Quantity;
                quantities.put(pbe.Product2Id, quantity);
                break;
            }
        }
    }
   
    update orders;
    Map<Id, Product2> currentProducts = new Map<Id, Product2>([Select Id, Quantity_Ordered__c FROM Product2 WHERE Id IN :productIds]);
  
    for (Product2 prod : oldProducts){
      
        TestDataFactory.VerifyQuantityOrdered(prod, currentProducts.get(prod.Id), quantities.get(prod.Id));
  }
  Test.stopTest();
}
}

 
Hey All, 

First time posting here, I look forward to what I can learn from the community.  I am a mostly self taught Admin so I suspect my issue stems from some of the common knoweldge gaps that newer self taught types can have.  I've read post after post and watched countless videos and can't figure out the small little thing that is hanging me up on this. I also see that this doesn't seem to have spell check so all you grammer hounds please grant me mercy. 

First, since language changes on these modules I'll post the step for future readers and then the error I'm getting. 
---
2)
Set record-level security settings
Configure other Salesforce settings related to record-level security to meet the business requirements.
Create a user, Samantha Cordero, and assign her the Field Sales User profile and the Field Sales role
Create an opportunity owned by Samantha with the stage name 'Needs Analysis'
Create a Closed Won opportunity owned by Samantha, with the type of 'Existing Customer - Upgrade'
---
The error on the apex test thing I get: "Assertion Failed: Field Sales users should not be able to read Opportunities owned by someone else. However, the test returned records not owned by the user. #sadtrombone: Expected: 1, Actual: 3"

So here are the few things I've drilled into and checked, I honestly can't think of anything else that I'm missing. Other parts of this could be messed up but as far as relation to the error thrown I just can't find it. 

1) Issue with the Profile, "Field Sales User". I don't think this is it due to the error throwing a lower case "user" which makes me think it's an issue with roles. Also this doesn't really have much to do with viewing rights beyond basic allowance so.. eh. Honestly I'm not even sure the best way to approach Profiles vs Roles, but again, noob here. In this profile I have the Opportunity object checked for everything except "delete" as the trail ask. 

User-added image

2) Roles. Now here is where we get to the good stuff. I've checked the hierchy and have tried to mark that lowly field reps are not worthy of viewing other's opportunities (humor y'all).  For your consideration here are shots of the hierchy and the field where I marked them as unworthy. 

User-added image 

User-added image

---
3) Sharing Settings. This is the last area I know of to deal with this error.  I have set Opportunities to private. This, in combination with the other rules really baffles me as to why field reps can still creep on other opportunities. For visual confirmation: 

User-added image

Any help or hints would be much appreciated on this.  In the event I make it out to Dreamforce and the lucky person that helps me out the most does I will gladly buy you a beer or coffee or heck even both! 

Cheers.