• Harshita Dwivedi
  • NEWBIE
  • 45 Points
  • Member since 2014
  • Consultant
  • Deloitte

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 4
    Questions
  • 7
    Replies
Hi friends,
I am trying to create page breaks in vf rendered word doc using page-break-after: always but it is generating a blank page at the end.
How to get rid of that blank page? any Sugegstions

Hey Friends,

I am stuck at challenge 1 of Lightning Experience Rollout Specialist .It has been 24 hrs and optimizer is still running and showing as below screen.
User-added image
when trying to check challenge,I am getting error as 
"Challenge Not yet complete... here's what's wrong: 
You need to run Salesforce Optimizer for your org.
"
Anyone of you encountered this .Any clues? 
Is it possible to render checkboxes in vf being rendered as word doc.
I want real-time select/unselect checkboxes. i.e the user can check/uncheck the checkbox in rendered word/pdf doc. 
I have tried apex and html input checkbox tags. The checkbox does not appear in rendered word .
 
Hello there,
I am an experienced salesforce developer(around 4 years).Looking for any opportunities to work as a freelancer/volunteer for any project/team.
Certifications in hand -dev401,platform1 developer.I am located in Naperville,Illinois.
Contact me @harshi.dwd@gmail.com
Thanks,
Harshita
We recently rolled out lightning and anytime Classic UI or Visualforce Page is loaded in Lightning Experience, that part of the page does not load. This affects standard pages such as the ones found in Setup as well as Visualforce pages embedded in Lightning Record pages. This affects only 2 users in all browsers. Salesforce IT won't help us because they say this is a Single Sign-on issue and is not covered for 'standard customers'.

The error in Chrome's developer console says: 
  • Refused to Display: ..okta/com/app/salesforce/... in a frame because it set 'X-Frame-Options' to 'sameorgin'

I understand that the error means the same orgin flag was set in the reponse header, but I don't know how to fix it since this is standard Salesforce embedding (iframe) functionality.  Note, clickjack protection has been turned off.

Has anyone run into this issue?

User-added imageUser-added image
Hello,
While solving challenge 8 I am getting an error:- 
Challenge Not yet complete... here's what's wrong: 
Ensure that orderTrigger and orderHelper are still working as specified in the earlier challenge.
Please let me know what I am doing wrong else paste the correct code here.
My code goes as follows-:

CLASS- OrderTests

@isTest
public class OrderTests {
    @testSetup 
    public static void SetupTestData() {     
            TestDataFactory.InsertTestData(3);      
    }
    
   @isTest
    public static void OrderUpdate_UnitTest (){
        Test.startTest();
        
        List<Product2> originalProduct=[Select Quantity_Ordered__c from Product2 where Name like 'ProductConstruction%'];
        
        List<Order> ord=new List<Order>();
        List<Order> testOrders=[Select status from Order where status='Draft'];
        System.debug('originalPro '+originalProduct);
        System.debug('Ordertest orders '+testOrders);
        
        for(Order o:testOrders){
            
            o.Status=Constants.ACTIVATED_ORDER_STATUS;
            ord.add(o);
        }
        System.debug('OrderTests 21 '+ord);
        update ord;
        List<Product2> updatedProduct=OrderHelper.pr; 
        //System.debug(updatedProduct.get(0)+' '+originalProduct.get(0));
           TestDataFactory.VerifyQuantityOrdered(originalProduct.get(0), updatedProduct.get(0), (Integer)OrderHelper.temp.get(0)); 
        Test.stopTest();
    }
    @isTest
    public static void OrderExtension_UnitTest (){
        Test.startTest();
        
        Account ac=new Account();
        ac.Name='Test1';
        insert ac;
        
        Contract ct=new Contract();
        ct.AccountId=ac.Id;
        ct.StartDate =date.today();
        ct.Status='Draft';
        ct.ContractTerm=4; 
        insert ct;
        
        Order obj=new Order();
        obj.AccountId=ac.Id;
        obj.EffectiveDate=date.today();
        obj.ContractId=ct.Id;
        obj.Status='Draft';
        obj.Name='OrderName';
       
        insert obj;
        
        ApexPages.StandardController sc = new ApexPages.StandardController(obj);
        
        OrderExtension cc=new OrderExtension(sc);
        cc.SelectFamily();
        cc.OnFieldChange();
        cc.Save();
        cc.First();
        cc.Next();
        cc.Previous();
        cc.Last();
        cc.GetHasPrevious();
        cc.GetHasNext();
        cc.GetTotalPages();
        cc.GetFamilyOptions();
        Test.stopTest();
    }
}

CLASS- prouct2Tests
@isTest (seeAllData=true)
private class Product2Tests {

    /**
     * @name product2Extension_UnitTest
     * @description UnitTest for product2Extension
    **/ 
    static TestMethod void Product2Extension_UnitTest(){
        Test.startTest();
           PageReference pageRef = Page.Product2New;
           Test.setCurrentPage(pageRef);
          
        
        ApexPages.StandardController controller =new Apexpages.StandardController(new Product2());
            Product2Extension ext = new Product2Extension(controller);
            ext.addRows();
            ext.save();
            System.assertEquals(Product2Extension.productsToInsert.size(), Constants.DEFAULT_ROWS);
        
         
         //if(addValue.equals('Add'))
                  //System.assertEquals(Product2Extension.productsToInsert.size(), 2*Constants.DEFAULT_ROWS);
        
        Integer i=0;
        for(Product2Extension.ProductWrapper pr: Product2Extension.productsToInsert){
            if (String.isBlank(pr.productRecord.Name) || pr.productRecord.Name==null){
                pr.productRecord.Name='Product'+i;
            }
               
            if(String.isBlank(pr.productRecord.Family) ||  pr.productRecord.Family==null ){
                pr.productRecord.Family='Side';
            }
                  
            if(pr.productRecord.IsActive==false){
                pr.productRecord.IsActive=true;
            }
            if(pr.productRecord.Initial_Inventory__c==null){
                pr.productRecord.Initial_Inventory__c=15;
            }
            i++;
                   
        }
        PageReference p=ext.save();
        List<Product2> queryResults=[Select Name,IsActive,Initial_Inventory__c from Product2 where Initial_Inventory__c=15 and IsActive= true and Family='Side'];
                Test.stopTest();
        System.assertEquals(queryResults.size(), 5);
        System.debug(Product2Extension.productsToInsert.size());       

    }
    static void Product2Trigger_UnitTest(){
        Test.startTest();
        
        Product2 p=new Product2();
        p.Name='TestProduct';
        p.Family='Side';
        p.IsActive=true;
        p.Quantity_Ordered__c =100;
        p.Initial_Inventory__c =10;
        insert p;
        
        p.Quantity_Ordered__c=200;
        update p;
            
        Test.stopTest();
    }

}

CLASS - OrderHelper
public without sharing class OrderHelper {

    /**
     * @name AfterUpdate
     * @description 
     * @param List<Order> newList
     * @param List<Order> oldList
     * @return void
    **/
    public static List<Product2> pr=new List<Product2>();
    public static List<Decimal> temp;
    public static void AfterUpdate(List<Order> newList, List<Order> oldList){
        Set<Id> orderIds = new Set<Id>();
        for ( Integer i=0; i<newList.size(); i++ ){
            if ( newList[i].Status == Constants.ACTIVATED_ORDER_STATUS && oldList[i].Status == Constants.DRAFT_ORDER_STATUS ){
                orderIds.add(newList[i].Id);
            }
        }
        System.debug('New Order '+newList);
        System.debug('Old Order '+oldList);
        System.debug('OrderIDS '+orderIds);
        OrderHelper.RollUpOrderItems(orderIds);
    }

    /**
     * @name RollUpOrderItems
     * @description Given a set of Activated Order ids, query the child Order Items and related Products to calculate Inventory levels
     * @param Set<Id> activatedOrderIds
     * @return void
    **/
    public static void RollUpOrderItems(Set<Id> activatedOrderIds){
        List<OrderItem> oi=[Select Id, Product2Id ,AvailableQuantity from OrderItem where OrderId IN:activatedOrderIds];
        Map<Id,Product2> productMap=new Map<Id,Product2>();
        //ToDo: Declare a Map named "productMap" of Ids to Product2 records

        //ToDo: Loop through a query of OrderItems related to the activatedOrderIds
        for(OrderItem ord:oi){
            Product2 p=[Select Id,Name, Quantity_Ordered__c , Quantity_Remaining__c from Product2 where Id=: ord.Product2Id ];
            productMap.put(ord.Product2Id, p);
         }
         
        
          AggregateResult[] groupedResults =[Select Product2Id,SUM(Quantity) from OrderItem where Product2Id IN : productMap.keySet() group by Product2Id];
        
        for(AggregateResult ag:groupedResults){
             Product2 p= productmap.get((Id)ag.get('Product2Id'));
               p.Quantity_Ordered__c =(Double)ag.get('expr0');
                temp.add(p.Quantity_Ordered__c);
               pr.add(p);
        }
        System.debug('orderHelper'+pr+' '+activatedOrderIds+' '+groupedResults);
        update pr;
            //ToDo: Populate the map with the Id of the related Product2 as the key and Product2 record as the value
            
        //ToDo: Loop through a query that aggregates the OrderItems related to the Products in the ProductMap keyset

        //ToDo: Perform an update on the records in the productMap
    }

}

Thanks in advance
Shubham Nandwana

Hey Friends,

I am stuck at challenge 1 of Lightning Experience Rollout Specialist .It has been 24 hrs and optimizer is still running and showing as below screen.
User-added image
when trying to check challenge,I am getting error as 
"Challenge Not yet complete... here's what's wrong: 
You need to run Salesforce Optimizer for your org.
"
Anyone of you encountered this .Any clues? 

I need to have products that have a prorated value for maintenance.   For example, normally the maintenance is for a year (12 months).   But if you only need it for 6 months or 8.5 months I need to adjust the price value on the product.  I would like to add custom fields (prorated checkbox, begin date, end date) to calcalute the range and then adjust the price value.   Any suggestions on where to apply this customization so I can change the price value if prorated,   I tried the opportunity and quote but can't seem to get what I want.

I need to convert vf page to pdf, In pdf i am not able to see the check boxs which are displyed in vf page and also having alignment issues.Does any one have suggestions.

 

  • July 19, 2011
  • Like
  • 0

Posting this in order to help others who, months from now, might Google "OP_WITH_INVALID_USER_TYPE_EXCEPTION" and find this explanation.

 

We wrote an Apex trigger on the User object, to insert a custom object record anytime a user updates their Chatter status.  This was done to fulfill a client's requirement to audit all Chatter activity.

 

The trigger worked fine, until one day the client signed up some Chatter Free users.  When such a user tried to update their status, they got a pop-up with an OP_WITH_INVALID_USER_TYPE_EXCEPTION error.

 

We scratched our collective heads for awhile.  After all, Apex triggers run in "system mode," right?  That is supposed to mean that "object and field-level permissions of the current user are ignored."  And yet this trigger seemed like it was running in "user mode," enforcing restrictions based on who the current user was.

 

The root cause turned out to be that a Chatter Free user cannot be the owner of a custom object record, and SFDC by default sets the current user as a new record's first owner.  We discovered this when we realized, via experiment, that Apex triggers fired as the result of actions by Chatter Free users could definitely update an existing record, but were having problems creating records.

 

So the simple solution was to explicitly set the owner of the new record to some fully-licensed user prior to inserting it.