• PRD12
  • 0 Points
  • Member since 2018

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 4
I'm getting the following error on Advanced Apex Specialist Superbadge - Step 5.  Any ideas please?
User-added image

Here is the current code segments:

Public static void VerifyQuantityOrdered(Product2 originalProduct, Product2 updatedProduct, Integer qtyOrdered) {
       	decimal tot = (originalProduct.Quantity_Ordered__c + qtyOrdered);
            system.debug('OldVQ ' + originalProduct.Quantity_Ordered__c);
            system.debug('NewVQ ' + updatedProduct.Quantity_Ordered__c);
            system.debug('QTYVQ ' + qtyOrdered);
private with sharing class OrderTests {

    private static void SetupTestData (){    

    private static void OrderUpdate_UnitTest (){
        List<Order> OrderList = [select id, name, status from order];

        For (Order ordrec : OrderList) {
            OrderItem oirec = [select id, Pricebookentry.product2Id from orderitem where orderid=:ordrec.id];
			Product2 oldprodrec = [SELECT Family,Id,Name,Quantity_Ordered__c,Quantity_Remaining__c 
                            	FROM Product2 where id =: oirec.Pricebookentry.product2Id  limit 1];
            ordrec.status = constants.ACTIVATED_ORDER_STATUS;
            update ordrec;
            OrderItem oirec1 = [select id, Pricebookentry.product2Id from orderitem where orderid=:ordrec.id];
			Product2 newprodrec = [SELECT Family,Id,Name,Quantity_Ordered__c,Quantity_Remaining__c 
                            	FROM Product2 where id =: oirec1.Pricebookentry.product2Id  limit 1]; 
            system.debug('Old ' + oldprodrec.Quantity_Ordered__c);
            system.debug('New ' + newprodrec.Quantity_Ordered__c);
            system.debug('QTY ' + constants.DEFAULT_ROWS);
@isTest  (seeAllData=false)
private with sharing class Product2Tests {

     * @name product2Extension_UnitTest
     * @description UnitTest for product2Extension
    private static void Product2Extension_UnitTest(){
// Set-up user
        String uniqueUserName = 'standarduser' + DateTime.now().getTime() + '@testorg.com';
        Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
        User u = new User(Alias = 'standt', Email='standarduser@testorg.com',
        	EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
        	LocaleSidKey='en_US', ProfileId = p.Id, TimeZoneSidKey='America/Los_Angeles', UserName=uniqueUserName);

        System.runAs(u) {
// When a user first visits the page, there should be multiple rows displayed on the screen. 
// Assert that the size of the productsToInsert list is equal to the DEFAULT_ROWS constant.
//		Test.StartTest(); 
        	Product2 prod = new Product2(name='Test',isActive=true);
        	ApexPages.StandardController stdc = new ApexPages.StandardController(prod);
        	Product2Extension p2x = new Product2Extension(stdc);        
       		System.assertEquals(Constants.DEFAULT_ROWS, p2x.productsToInsert.size());
//		Test.StopTest();  

// When the Add button is clicked, an additional set of rows should be added, 
// so assert that the size of the productsToInsert ** list is double **DEFAULT_ROWS after the button is clicked once. 
//        Test.StartTest();
        	System.assertEquals(Constants.DEFAULT_ROWS * 2, p2x.productsToInsert.size());
//		Test.StopTest();          

// Next, test the Save button. Verify that populated rows are saved and unpopulated rows are not saved. 
// Loop through the rows in the productsToInsert list and populate the values of the first 5 records, 
// and then simulate clicking the Save button. Verify that the button worked by asserting that only 5 products were saved.
		integer x = 0; 
        for (Product2Extension.ProductWrapper PTI : p2x.productsToInsert){
            pti.productrecord.name='TESTPRODUCT ' + x;
            pti.productRecord.IsActive = true;
            pti.productRecord.Initial_Inventory__c = 20;
            pti.productRecord.Family = Constants.PRODUCT_FAMILY[0].getValue();           
            pti.pricebookEntryRecord.UnitPrice = 10;
        	x++; if (x==5) {break;}

//        Test.startTest();
//        Test.stopTest();
        List<Product2> createdProducts = [SELECT Id FROM Product2];
        System.assertEquals(5, createdProducts.size());

// plus some more test areas        


Hi All,

I am attempting the Security Specialist Superbadge and have the following error: -

Challenge Not yet complete... here's what's wrong: 
The Account object level permissions are not configured correctly for the Field Sales User profile.

In the Field Sales User Profile / Object Settings I have Read/Create/Edit ticked for the Account Object, and the OWD for the Account Object is Public Read/Write

The question does state that: -
Note: When providing access to see and edit all accounts for Field Sales, do not use the profile View All and Modify All settings.

So I know ticking the View All Object Permission isn't correct (I tried it just in case, and it didn't work!)

The thing I think I'm missing is in the pre-work is states that:-
They [Fieled Sales User Profile] should also be able to read, create, and edit (but not delete) their own opportunities; and read and edit all accounts. 

and I think it's the read and edit on all accounts that I am missing. 

Any help would be appreciated.
Hi there, 

I got following error on step 3.

A Volunteer Shift Worker record created for another user is not in their approval queue, or it does not have the correct status automatically assigned.

Anyone passed this step?


Part of the module is where you create couple of profiles with object level permissions. Accordingly i have set the right permissions for account object (R/E/VA), Opportunity (R/C/E) -- NO VIEW ALL for Field Sales Profile.

Everytime i check the challenge am getting below error; any help.
Challenge Not yet complete... here's what's wrong: 
The Field Sales User does not appear to have the correct object permissions for Accounts and Opportunities.

need salesforce support in california timings