• goabhigo
  • PRO
  • 2745 Points
  • Member since 2010


  • Chatter
    Feed
  • 81
    Best Answers
  • 6
    Likes Received
  • 3
    Likes Given
  • 62
    Questions
  • 873
    Replies
HI Team,

Please let me how to get rid of this error,

My Controller method.

public void Init()
    {
        System.debug('Test method called');
         strText = ApexPages.currentPage().getParameters().get('str');
        //strText1 = ApexPages.currentPage().getParameters().get('str1');
        System.debug(strText);
        list<String> strTextVal = strText.split(',');
        System.debug(strTextVal[0]);
        System.debug(strTextVal[1]);
        queryData = [select RadioFeild__c, During_Week_Availability__c,Status__c,Reason_Comments__c,Reason_comments_for_Recent_Rejection__c, During_Week_OtherWorkFile__c, During_Week_OtherWorkEst__c,During_Week_FileSelection__c,During_Week__c,During_Week_Debreifs__c,During_Week_Core__c, Reason_Rejection__c, Other3_core__c, Total_Total_time__c, CommentsAvailability__c, Other1Title__c, Other2Title__c, Picklist__c, Date_QAAM__c, Week_Start_Date__c,
                                                  Availability__c, ReasonAvailability__c, Work_Hours__c, Pre_Vet_Reviews__c, BAU_File_Reviews__c, Debriefs__c,
                                                  File_Selection__c, Other_work__c, Other_work_Estimate__c, Total_Work_Time__c, Team_Meeting__c, Huddle__c, 
                                                  Quarterly_Updates__c, Governance_Forums__c, Performance_Reviews__c, Tea_Breaks__c, CPD_e_Learning_Maintenance__c, 
                                                  Coaching__c, PD_Days__c, One_on_Ones__c, Weekly_Tracker_preparation__c, Business_Communications__c, 
                                                  Other__c, Other1__c, Other2__c, Project_Time__c, Other_Time__c, Project_Time_Description__c, 
                                                  Other_Time_Description__c, Shrinkage_time__c, Available_Time__c, Availability_Checking__c, id, Week__C 
                                                  from QAAM_Weekly_Planner__c where Week__C =: strTextVal[0] and CreatedBy.Name =:strTextVal[1]];
        list<String> weekDataStatic = new list<String>{'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'};
            integer i=0;
            
}

My test class

 static testmethod void Init()
    {
        a init = new a();
        init.strText = 'abc,abc';

        init.queryData = [select CommentsAvailability__c, Other1Title__c, Other2Title__c, Picklist__c, 
                                                  Date_QAAM__c, Week_Start_Date__c, Availability__c, ReasonAvailability__c, 
                                                  Work_Hours__c, Pre_Vet_Reviews__c, BAU_File_Reviews__c, Debriefs__c, File_Selection__c,
                                                  Other_work__c, Other_work_Estimate__c, Total_Work_Time__c, Team_Meeting__c, Huddle__c,
                                                  Quarterly_Updates__c, Governance_Forums__c, Performance_Reviews__c, Tea_Breaks__c, 
                                                  CPD_e_Learning_Maintenance__c, Coaching__c, PD_Days__c, One_on_Ones__c, 
                                                  Weekly_Tracker_preparation__c, Business_Communications__c, Other__c, Other1__c, 
                                                  Other2__c, Project_Time__c, Other_Time__c, Project_Time_Description__c, 
                                                  Other_Time_Description__c, Shrinkage_time__c, Available_Time__c, 
                                                  Availability_Checking__c, id, Week__C from QAAM_Weekly_Planner__c];

test.startTest();
        init.Init();
        test.stopTest();

}

Error:
System.NullPointerException: Attempt to de-reference a null object
I have a Site User who accesses records through a VF page. I am encountering a strange problem where, Files uploaded in Lightning is visible but not the files those were uploaded in Classic.
When debugged, SOQL query is returning all in Execute Anonymous, but Debug Logs show only limited (uploaded in Lightning). Below is the code used for querying the files.
List<ContentDocumentLink> docList = [select ContentDocumentId, ContentDocument.title from ContentDocumentLink where LinkedEntityId =:recordId]; 
​system.debug('docList: ' + docList);
Any idea how to solve this? More importantly any idea why this is happening?
There is a record where Owner could "Recall approval process" before, I have removed "Modify All" permission on the profile which was assigned to that owner, now recall approval process button is not visible for him. Is there any way that the owner can recall approval process without "Modify All" permission?
trigger UpdateOwnerID on Case (after insert) {

 

List<Case> cases = new List<Case>();

map<Id,String> userIdbyAlias = new map<Id,String>();  //Keep in mind this will only store one user id per alias
    
    for(User u : [Select id,Name from user where IsActive = true AND Profile.Name = 'AH JP – Customer Request Agent'])
    {
            userIdbyAlias.put(u.Id,u.Name);
            system.debug('*** User names'+userIdbyAlias);
     }
  system.debug('**List of user from profile **'+userIdbyAlias);
   for (Case c : [Select Id, OwnerId, CreatedById From Case Where Id IN : Trigger.newMap.keySet()]) {

     for(User u :userIdbyAlias.keySet()){

     if(u.contains(c.OwnerId)) {

            c.OwnerId = userIdByAlias.get(u).Id;
            cases.add(c);
       }
  
     }
  }
   if(cases.size() > 0)
            update cases;
            system.debug('*** Final Output ***'+cases);
}
HI All,

can anyone let me know on how can we upload files from salesfore to sharepoint?
and if possble also let me know the steps for the same

Thanks 
This is super frustrating.  I have completed Challenge 8 successfully, but get this error

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: GQNDQNGL
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: KHXLXNMW



i have tried doing this in new org but same error occurs.Please help.
Getting Stuck with Following error while verifying Challenge 8 .Tried in multiple Trailhead Playgrounds and Developer Edition,But no Success.
Any known Isuues ?

User-added image

 
Is there way to get the details of report export? I need to know which user exported, with time stamp. I am guessing this can be done using Analytics API, but not finding any helpful article/notes or any related params in API Guide too.
Hi ,
I want to Generate  my current visualforce page  In Pdf Format when click on a  Custom Button which is on the same page  ,the class  consist a wrapper class which has a checkbox & values , I have created a pagerefernce Method but how to generate in Pdf.

<apex:page standardController="Account" extensions="SolutionParticipationCategoryController" sidebar="False" > 
<head>
<style type="text/css"> 
#rows{
        padding-left:250px;
        padding-Right:250px;
        
}
#cellAlign{
    vertical-align: top;
    border-collapse: collapse;
    border: 1px solid black;
}

 </style>
</head>
    <apex:form >
      <apex:sectionHeader title="Account" subtitle="Key Solutions Inventory "/>
            <apex:pageBlock >
                <apex:pageBlockbuttons >
                    <apex:commandButton value="Open Account" action="{!OpenAccount}"/>
                    <apex:commandButton value="Solution Participation " action="{!SolutionParticipation}" />
                    <apex:commandButton value="Card Program " action="{!cardProgram}" />
                    <apex:commandButton value="View Pdf"  action="{!ViewPDF}"/>
                </apex:pageBlockbuttons>
                                
            
                <table style="border-collapse: collapse;padding:50px;">
                    <tr>
                        <apex:repeat value="{!resultPickValuesMap}" var="M">
                            <td style="vertical-align: top;padding:30px;text-align:left;">
                               <b style="text-align:center;">{!M}</b><br/>
                               <apex:repeat value="{!resultPickValuesMap[M]}" var="temp">
                                   <table>
                                       <tr>
                                           <td style="padding-top:5px;">
                                               <apex:inputCheckbox value="{!temp.isSelected}" disabled="true"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                               <apex:commandLink id="theLink" action="{!solutionList}" target="_blank">
                                                   <apex:param assignTo="{!solName}" value="{!temp.value}" name="solName"/>
                                                   <apex:outputText value="{!temp.value}"/>
                                               </apex:commandLink>
                                            </td>
                                        </tr>
                                   </table>
                               </apex:repeat>
                            </td>
                         </apex:repeat>
                     </tr>
                </table>
            </apex:pageblock>         
    </apex:form>
</apex:page>

controller:-
/* *****
 Date:- 8/1/2018
 Description :- This Class is used to get the Multiselect Values from Account & displayed in New Vf Page on key solution Inventory button & checked 
                If altleast One Solution is Active so the Checkbox get checked. 
*/
public with sharing class SolutionParticipationCategoryController 
{
    public Id acctId{get;set;}
    public String solName{get;set;}
    public Set<String> CategorySelected{get;set;}   
    Public MAP<String,LIST<Account>> accsCategoryByType{get;set;} 
    public Map<String, List<PicklistWrapper>> resultPickValuesMap{get;set;}
    public Set<String> controllKeySet{get;set;}
    public List<PicklistWrapper> enterpriseCardSolutionsList;
    public List<PicklistWrapper> creditList;
    public List<PicklistWrapper> debitList;
    public List<PicklistWrapper> advisorsPlusList;
    Public List<Solution_Participation__c>sp;
    Public Integer count;
    Public Map<String,Integer> checkActMap;
    
    public SolutionParticipationCategoryController(ApexPages.StandardController stdController) 
    {
        acctId = ApexPages.currentPage().getParameters().get('id');
        System.debug('acctId-->'+acctId);
        CategorySelected = new Set<String>();
        resultPickValuesMap = getDependentOptionsImpl();
    }
    public Map<String,List<PicklistWrapper>> getDependentOptionsImpl()
    {
        String objApiName = 'Account';
        String contrfieldApiName = 'Picklist_Independent__c';
        String depfieldApiName = 'Solution_Participation_Category__c';
        String objectName = objApiName.toLowerCase();
        String controllingField = contrfieldApiName.toLowerCase();
        String dependentField = depfieldApiName.toLowerCase();
        
        
        checkActMap = new Map<String,Integer>();
        Map<String,List<PicklistWrapper>> objResults = new Map<String,List<PicklistWrapper>>();
            //get the string to sobject global map
        Map<String,Schema.SObjectType> objGlobalMap = Schema.getGlobalDescribe();
         
        if (!Schema.getGlobalDescribe().containsKey(objectName))
           {
            System.debug('OBJNAME NOT FOUND --.> ' + objectName);
            return null;
           }
        
        Schema.SObjectType objType = Schema.getGlobalDescribe().get(objectName);
        if (objType==null){
            return objResults;
        }
        Bitset bitSetObj = new Bitset();
        Map<String, Schema.SObjectField> objFieldMap = objType.getDescribe().fields.getMap();
        //Check if picklist values exist
        if (!objFieldMap.containsKey(controllingField) || !objFieldMap.containsKey(dependentField)){
            System.debug('FIELD NOT FOUND --.> ' + controllingField + ' OR ' + dependentField);
            return objResults;     
        }
        
        List<Schema.PicklistEntry> contrEntries = objFieldMap.get(controllingField).getDescribe().getPicklistValues();
        List<Schema.PicklistEntry> depEntries = objFieldMap.get(dependentField).getDescribe().getPicklistValues();
         objFieldMap = null;
        List<Integer> controllingIndexes = new List<Integer>();
        for(Integer contrIndex=0; contrIndex<contrEntries.size(); contrIndex++) {            
            Schema.PicklistEntry ctrlentry = contrEntries[contrIndex];
            String label = ctrlentry.getLabel();
            objResults.put(label,new List<PicklistWrapper>());
            controllingIndexes.add(contrIndex);
        }
        List<Schema.PicklistEntry> objEntries = new List<Schema.PicklistEntry>();
        List<PicklistEntryWrapper> objJsonEntries = new List<PicklistEntryWrapper>();
        for(Integer dependentIndex=0; dependentIndex<depEntries.size(); dependentIndex++){            
               Schema.PicklistEntry depentry = depEntries[dependentIndex];
               objEntries.add(depentry);
        } 
        objJsonEntries = (List<PicklistEntryWrapper>)JSON.deserialize(JSON.serialize(objEntries), List<PicklistEntryWrapper>.class);
        List<Integer> indexes;
        Account a = [SELECT Solution_Participation_Category__c,(SELECT Id,solution_name__c,Active__c FROM solution_participations__r) FROM Account WHERE Id =: acctId limit 1];
        List<Solution_Participation__c> mySol = a.solution_participations__r;
        Schema.DescribeFieldResult fieldResult = Account.Solution_Participation_Category__c.getDescribe();
        List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        for(PicklistEntryWrapper pew : objJsonEntries){
        count=0;
            for(Solution_Participation__c solp:mySol){
                if(solp.Active__c==true && solp.solution_name__c==String.valueof(pew.label)){
                    count++;
                    checkActMap.put(String.valueof(pew.label),count);
                }
            }
        }
        if(a.Solution_Participation_Category__c != null )
        {
          
           CategorySelected.addAll(a.Solution_Participation_Category__c.split(';'));
           
        }
       
        //Schema.DescribeFieldResult fieldResult = Account.Solution_Participation_Category__c.getDescribe();
        //List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        
       
        for (PicklistEntryWrapper objJson : objJsonEntries){
            if (objJson.validFor==null || objJson.validFor==''){
                continue;
            }
               indexes = bitSetObj.testBits(objJson.validFor,controllingIndexes);
            sp= [select Id,Active__c, Account__r.Solution_Participation_Category__c From Solution_Participation__c where Account__c =: acctId limit 1];  
            for (Integer idx : indexes)
              {                
                String contrLabel = contrEntries[idx].getLabel();
                
                if(CategorySelected.contains(String.valueof(objJson.label))&&checkActMap.get(String.valueof(objJson.label))>0)
                {
                  
                  
                    objResults.get(contrLabel).add(new PicklistWrapper(objJson.label,true));
                }
                else
                {
                    objResults.get(contrLabel).add(new PicklistWrapper(objJson.label,false));
                }
            }
        }
        objEntries = null;
        objJsonEntries = null;
        system.debug('objResults--->' + objResults);
        return objResults;
    }
    public class PicklistWrapper 
        {
        public String value {get;set;}
        public Boolean isSelected {get;set;}
        
        public PicklistWrapper(String value, Boolean isSelected) 
                {
            this.value = value;
            this.isSelected = isSelected;
        }
    }
    public PageReference solutionList()
    {
        System.debug('SolName-->'+solName);  
        PageReference solutionList = new Pagereference('/apex/SolutionList');
        solutionList.getParameters().put('Id', acctId);
        solutionList.getParameters().put('solName', solName);
        
        solutionList.setRedirect(true);
        
        return solutionList;      
    }
    
  
    public PageReference OpenAccount() 
    {
        Pagereference acc = new Pagereference('/'+acctId);
        acc.setRedirect(true);
        return acc;
    }
    
    Public PageReference SolutionParticipation()
    {
    id ReportId = [Select id from Report where name = 'Solution Participants'].id;
        
    Pagereference sp= new Pagereference('/'+ReportId);
     sp.setRedirect(true);
     return sp;
    
    }
    
    Public PageReference CardProgram()
    {
    id ReportId1 = [Select id from Report where name = 'Card Programs'].id;
    Pagereference cp= new Pagereference('/'+ReportId1);
    cp.setRedirect(true);
    return cp;
    
    }
    
  /*  Public PageReference ViewPDF(){
    pageReference vpdf = page.solutionparticipationPDF;
    vpdf.setRedirect(true);
    return vpdf;
    }*/

}
Hello dear community, I was wondering how exactly to delete an apex class because obviously you can't do that in the production area, I already tried deleting it from my sandbox which worked but it didnt have any impact on my actual production area.
Thanks in advance