• Arun Yadav 13
  • NEWBIE
  • 30 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 14
    Replies
I have created a dashboard using multiple reports. As per the requirement after clicking 'Manage External User'/'Log in to community as user' I need to jump to a page and then I should be able to view dashboard.
However when I'm clicking on Dashboard tab I'm unable to view 1 tab i.e. 'Payout Dashboard - Default'. I'm getting following erors:

Dashboard Errors

Any suggessions please.

Arun
Hi

I'm trying to imlement actionFunction in my vf page, but I'm unable to do. I'm unable to display the value of my prod variable.

Here is my code.

//VF Code
<apex:page controller="ExtPosition">
  <apex:form >
<apex:actionFunction action="{!productSearch}" name="productSearch" rerender="Outpano">  </apex:actionFunction>   
<apex:outputPanel id="Outpano"> <br/>
Here is another Text : {!prod}<apex:OutputText value="{!prod}" />
</apex:outputPanel>

</apex:form>
</apex:page>

//Function
public class ExtPosition{
 
public List<String> title {get;set;}
public String OutputString {get;set;}
public String EnterData {get;set;}
public String prod{get;set;}
List<Position__c> pos = new List<Position__c>([select Name,Position_title__c from Position__c]);

public ExtPosition()
{
   title = new List<String>();
   {
   For (Position__c p : pos)
   {
    title.add(p.Position_title__c);
   }

   }
}

 public void EnterData()
 {
    OutputString=EnterData;
 }

//List<String>
 public void productSearch()
 {
     prod='Arun';
 }   
    
}
Hi,

I'm getting null point exception error : attempt to de-reference object which is null at below line.

Utils.getQuoteIdsForSupportItems(newLst,oldLst);

/*test class
  QuoteLineItem qli1 = new QuoteLineItem();
  qli1.QuoteId = q.Id;
  qli1.PricebookEntryId =Pbentry.Id;
  qli1.Discount=91;         
  qli1.Quantity=8;
  qli1.Product2Id = p.Id;
  qli1.UnitPrice=98;
  qli1.Description =p.Description;  
//  insert qli1;

  QuoteLineItem qli2 = new QuoteLineItem();
  qli2.QuoteId = q.Id;
  qli2.PricebookEntryId =Pbentry.Id;
  qli2.Discount=92;         
  qli2.Quantity=1;
  qli2.Product2Id = p.Id;
  qli2.UnitPrice=94;
  qli2.Description =p.Description;  
//  insert qli2;
 
  QuoteLineItem qli3 = new QuoteLineItem();
  qli3.QuoteId = q.Id;
  qli3.PricebookEntryId =Pbentry.Id;
  qli3.Discount=92;         
  qli3.Quantity=1;
  qli3.Product2Id = p.Id;
  qli3.UnitPrice=94;
  qli3.Description =p.Description;  
//  insert qli3;

  List<QuoteLineItem> oldLst = new List<QuoteLineItem>();
  oldLst.add(qli1);
  oldLst.add(qli2);
  oldLst.add(qli3);
  insert oldLst;
 
  QuoteLineItem qli4 = new QuoteLineItem();
  qli4.QuoteId = q.Id;
  qli4.PricebookEntryId =Pbentry.Id;
  qli4.Discount=41;         
  qli4.Quantity=7;
  qli4.Product2Id = p.Id;
  qli4.UnitPrice=99;
  qli4.Description =p.Description;  
//  insert qli4;

  QuoteLineItem qli5 = new QuoteLineItem();
  qli5.QuoteId = q.Id;
  qli5.PricebookEntryId =Pbentry.Id;
  qli5.Discount=23;         
  qli5.Quantity=10;
  qli5.Product2Id = p.Id;
  qli5.UnitPrice=81;
  qli5.Description =p.Description;  
//  insert qli5;

  QuoteLineItem qli6 = new QuoteLineItem();
  qli6.QuoteId = q.Id;
  qli6.PricebookEntryId =Pbentry.Id;
  qli6.Discount=24;
  qli6.Quantity=11;
  qli6.Product2Id = p.Id;
  qli6.UnitPrice=82;
  qli6.Description =p.Description;  
//  insert qli6;

  List<QuoteLineItem> newLst = new List<QuoteLineItem>();
  newLst.add(qli4);
  newLst.add(qli5);
  newLst.add(qli6);
  insert newLst;

Utils.getQuoteIdsForSupportItems(newLst,oldLst);

/*method to test..
  public static Set<Id> getQuoteIdsForSupportItems(List<QuoteLineItem> newList, List<QuoteLineItem> oldList) {
    Set<Id> prodIds = new Set<Id>();
    if(trigger.isInsert || trigger.isUpdate) {
      for(QuoteLineItem qli : newList) {
        prodIds.add(qli.Product2Id);
      }
    } else {
      for(QuoteLineItem qli : oldList) {
        prodIds.add(qli.Product2Id);
      }
    }
    
    Map<Id, Product2> prodMap = new Map<Id, Product2>([select Requires_Support_Fees__c
                        from Product2
                        where id in:prodIds
                        and Requires_Support_Fees__c = true]);
    Set<Id> quoteIds = new Set<Id>();
    if(trigger.isInsert || trigger.isUpdate) {
      for(QuoteLineItem qli : newList) {
        if(prodMap.containsKey(qli.Product2Id)) {
          quoteIds.add(qli.QuoteId);
        }
      }
    } else {
      for(QuoteLineItem qli : oldList) {
        if(prodMap.containsKey(qli.Product2Id)) {
          quoteIds.add(qli.QuoteId);
        }
      }
    }
    system.debug('quoteIds:'+quoteIds);
    return quoteIds;
  }


Please advice..

Arun
Hi

I need to write a test class from below approval process. Can anyone please help me

    public static Approval.ProcessResult removeQuoteFromApproval(Id quoteId) {
      List<ProcessInstance> piList = [Select p.TargetObjectId, p.Status From ProcessInstance p where TargetObjectId = :quoteId];
      Approval.ProcessResult result =  null;
      if(piList.size() > 0 && piList[0].Status == 'Pending') {
        Approval.ProcessWorkitemRequest pwr = new Approval.ProcessWorkitemRequest();
      pwr.setAction('Removed');
      pwr.setComments('Quote submitted with updated discounts');
      pwr.setWorkitemId(quoteId);
      result = Approval.process(pwr);
      
      if(!result.isSuccess()) {
          Database.Error[] errors = result.getErrors();
          for(Database.Error dbe : errors) {
            system.debug(dbe.getMessage());
          }
        }
      }
      
      return result;
    }

Thanks
Hi,

I have below statement in one of my apex class. I found first 3 words in the object fields but I'm unable to find Sort_Order__c. Can anyone please tell me if this is keyword, if so what it does. If not please let me know where can I find this variable in salesforce setup .

PriceBookEntry.Product2.Product_Family__r.Sort_Order__c

Arun
Hi,

While going through the code of one of the class in my project I found that PriceBookEntry object is used. However when I tried to find it in setup/object menu I couldn't find. But I can find this object in eclipse as PricebookEntry.object.

Can anyone please let me know how I can find it in setup.

Arun.
Hi
I need to Sort entries of quoteLineItemList by PriceBookEntry.Product2.Product_Family__r.Sort_Order__c and PriceBookEntry.Product2.ProductCode and then store the sorted list in orderedLineItem.

How can I do this using apex code.


 
Hi

I need to write a test class from below approval process. Can anyone please help me

    public static Approval.ProcessResult removeQuoteFromApproval(Id quoteId) {
      List<ProcessInstance> piList = [Select p.TargetObjectId, p.Status From ProcessInstance p where TargetObjectId = :quoteId];
      Approval.ProcessResult result =  null;
      if(piList.size() > 0 && piList[0].Status == 'Pending') {
        Approval.ProcessWorkitemRequest pwr = new Approval.ProcessWorkitemRequest();
      pwr.setAction('Removed');
      pwr.setComments('Quote submitted with updated discounts');
      pwr.setWorkitemId(quoteId);
      result = Approval.process(pwr);
      
      if(!result.isSuccess()) {
          Database.Error[] errors = result.getErrors();
          for(Database.Error dbe : errors) {
            system.debug(dbe.getMessage());
          }
        }
      }
      
      return result;
    }

Thanks
I have created a dashboard using multiple reports. As per the requirement after clicking 'Manage External User'/'Log in to community as user' I need to jump to a page and then I should be able to view dashboard.
However when I'm clicking on Dashboard tab I'm unable to view 1 tab i.e. 'Payout Dashboard - Default'. I'm getting following erors:

Dashboard Errors

Any suggessions please.

Arun
Hi

I'm trying to imlement actionFunction in my vf page, but I'm unable to do. I'm unable to display the value of my prod variable.

Here is my code.

//VF Code
<apex:page controller="ExtPosition">
  <apex:form >
<apex:actionFunction action="{!productSearch}" name="productSearch" rerender="Outpano">  </apex:actionFunction>   
<apex:outputPanel id="Outpano"> <br/>
Here is another Text : {!prod}<apex:OutputText value="{!prod}" />
</apex:outputPanel>

</apex:form>
</apex:page>

//Function
public class ExtPosition{
 
public List<String> title {get;set;}
public String OutputString {get;set;}
public String EnterData {get;set;}
public String prod{get;set;}
List<Position__c> pos = new List<Position__c>([select Name,Position_title__c from Position__c]);

public ExtPosition()
{
   title = new List<String>();
   {
   For (Position__c p : pos)
   {
    title.add(p.Position_title__c);
   }

   }
}

 public void EnterData()
 {
    OutputString=EnterData;
 }

//List<String>
 public void productSearch()
 {
     prod='Arun';
 }   
    
}
Hi,

I'm getting null point exception error : attempt to de-reference object which is null at below line.

Utils.getQuoteIdsForSupportItems(newLst,oldLst);

/*test class
  QuoteLineItem qli1 = new QuoteLineItem();
  qli1.QuoteId = q.Id;
  qli1.PricebookEntryId =Pbentry.Id;
  qli1.Discount=91;         
  qli1.Quantity=8;
  qli1.Product2Id = p.Id;
  qli1.UnitPrice=98;
  qli1.Description =p.Description;  
//  insert qli1;

  QuoteLineItem qli2 = new QuoteLineItem();
  qli2.QuoteId = q.Id;
  qli2.PricebookEntryId =Pbentry.Id;
  qli2.Discount=92;         
  qli2.Quantity=1;
  qli2.Product2Id = p.Id;
  qli2.UnitPrice=94;
  qli2.Description =p.Description;  
//  insert qli2;
 
  QuoteLineItem qli3 = new QuoteLineItem();
  qli3.QuoteId = q.Id;
  qli3.PricebookEntryId =Pbentry.Id;
  qli3.Discount=92;         
  qli3.Quantity=1;
  qli3.Product2Id = p.Id;
  qli3.UnitPrice=94;
  qli3.Description =p.Description;  
//  insert qli3;

  List<QuoteLineItem> oldLst = new List<QuoteLineItem>();
  oldLst.add(qli1);
  oldLst.add(qli2);
  oldLst.add(qli3);
  insert oldLst;
 
  QuoteLineItem qli4 = new QuoteLineItem();
  qli4.QuoteId = q.Id;
  qli4.PricebookEntryId =Pbentry.Id;
  qli4.Discount=41;         
  qli4.Quantity=7;
  qli4.Product2Id = p.Id;
  qli4.UnitPrice=99;
  qli4.Description =p.Description;  
//  insert qli4;

  QuoteLineItem qli5 = new QuoteLineItem();
  qli5.QuoteId = q.Id;
  qli5.PricebookEntryId =Pbentry.Id;
  qli5.Discount=23;         
  qli5.Quantity=10;
  qli5.Product2Id = p.Id;
  qli5.UnitPrice=81;
  qli5.Description =p.Description;  
//  insert qli5;

  QuoteLineItem qli6 = new QuoteLineItem();
  qli6.QuoteId = q.Id;
  qli6.PricebookEntryId =Pbentry.Id;
  qli6.Discount=24;
  qli6.Quantity=11;
  qli6.Product2Id = p.Id;
  qli6.UnitPrice=82;
  qli6.Description =p.Description;  
//  insert qli6;

  List<QuoteLineItem> newLst = new List<QuoteLineItem>();
  newLst.add(qli4);
  newLst.add(qli5);
  newLst.add(qli6);
  insert newLst;

Utils.getQuoteIdsForSupportItems(newLst,oldLst);

/*method to test..
  public static Set<Id> getQuoteIdsForSupportItems(List<QuoteLineItem> newList, List<QuoteLineItem> oldList) {
    Set<Id> prodIds = new Set<Id>();
    if(trigger.isInsert || trigger.isUpdate) {
      for(QuoteLineItem qli : newList) {
        prodIds.add(qli.Product2Id);
      }
    } else {
      for(QuoteLineItem qli : oldList) {
        prodIds.add(qli.Product2Id);
      }
    }
    
    Map<Id, Product2> prodMap = new Map<Id, Product2>([select Requires_Support_Fees__c
                        from Product2
                        where id in:prodIds
                        and Requires_Support_Fees__c = true]);
    Set<Id> quoteIds = new Set<Id>();
    if(trigger.isInsert || trigger.isUpdate) {
      for(QuoteLineItem qli : newList) {
        if(prodMap.containsKey(qli.Product2Id)) {
          quoteIds.add(qli.QuoteId);
        }
      }
    } else {
      for(QuoteLineItem qli : oldList) {
        if(prodMap.containsKey(qli.Product2Id)) {
          quoteIds.add(qli.QuoteId);
        }
      }
    }
    system.debug('quoteIds:'+quoteIds);
    return quoteIds;
  }


Please advice..

Arun
Hi

I need to write a test class from below approval process. Can anyone please help me

    public static Approval.ProcessResult removeQuoteFromApproval(Id quoteId) {
      List<ProcessInstance> piList = [Select p.TargetObjectId, p.Status From ProcessInstance p where TargetObjectId = :quoteId];
      Approval.ProcessResult result =  null;
      if(piList.size() > 0 && piList[0].Status == 'Pending') {
        Approval.ProcessWorkitemRequest pwr = new Approval.ProcessWorkitemRequest();
      pwr.setAction('Removed');
      pwr.setComments('Quote submitted with updated discounts');
      pwr.setWorkitemId(quoteId);
      result = Approval.process(pwr);
      
      if(!result.isSuccess()) {
          Database.Error[] errors = result.getErrors();
          for(Database.Error dbe : errors) {
            system.debug(dbe.getMessage());
          }
        }
      }
      
      return result;
    }

Thanks
Hi,

While going through the code of one of the class in my project I found that PriceBookEntry object is used. However when I tried to find it in setup/object menu I couldn't find. But I can find this object in eclipse as PricebookEntry.object.

Can anyone please let me know how I can find it in setup.

Arun.
Hi
I need to Sort entries of quoteLineItemList by PriceBookEntry.Product2.Product_Family__r.Sort_Order__c and PriceBookEntry.Product2.ProductCode and then store the sorted list in orderedLineItem.

How can I do this using apex code.