• Tyler Harris 8
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 3
    Replies
I'm trying to use the Lighting Path with Coach Class and get the scrollable arrows to work.  However, I can't set scrollable attribute on the inner div and I get this error:
 
Action failed: c:opportunityApprovalHistoryLightning$controller$popright [Cannot create property 'scrollLeft' on string '

How can I make the Chevon left right buttons scroll the div view appropriately? Here is the link to the LDS item I using for further context. I just want to be able to scroll left and right using the buttons.
User-added image

Lightning Component
<aura:component controller="opportunityApprovalHistoryLightning" implements="lightning:actionOverride,force:hasRecordId,flexipage:availableForAllPageTypes" access="Global" >

 <lightning:layout horizontalAlign="center" multipleRows="true">
     <lightning:layoutItem flexibility="grow" size="12" padding="around-small">
    <lightning:buttonGroup >
       <lightning:button label="Submit for Approval" variant="brand" class="slds-m-top_medium" onclick="
            <div class="slds-path__scroller" role="application" aura:id = "scroller_outer">
                
               <div class="slds-path__scroller_inner" aura:id = "scroller_inner">
                  <ul class="slds-path__nav" role="tablist">
                     <li class="slds-path__item slds-is-incomplete" role="presentation">
                        <a aria-controls="path-content-1" aria-expanded="true" aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-1" role="tab" tabindex="-1">
                           <span class="slds-path__stage">
                             <lightning:icon iconName="utility:check" size="xx-small" />
                              <!--<span class="slds-assistive-text">Stage Complete</span>-->
                           </span>
                           <span class="slds-path__title">Sales Manager</span>
                        </a>
                     </li>
                     <li class="slds-path__item slds-is-incomplete " role="presentation">
                        <a aria-controls="path-content-2" aria-expanded="true" aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-2" role="tab" tabindex="-1">
                           <span class="slds-path__stage">
                              <lightning:icon iconName="utility:check" size="xx-small" />
                              <span class="slds-assistive-text">Stage Complete</span>
                           </span>
                           <span class="slds-path__title">Regional Segment Director</span>
                        </a>
                     </li>
                     <li class="slds-path__item slds-is-incomplete " role="presentation">
                        <a aria-controls="path-content-3" aria-expanded="true" aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-3" role="tab" tabindex="-1">
                           <span class="slds-path__stage">
                             <lightning:icon iconName="utility:check" size="xx-small" />
                              <span class="slds-assistive-text">Stage Complete</span>
                           </span>
                           <span class="slds-path__title">Product Marketing </span>
                        </a>
                     </li>
                     <li class="slds-path__item slds-is-incomplete" role="presentation">
                        <a aria-controls="path-content-4" aria-expanded="true" aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-4" role="tab" tabindex="-1">
                           <span class="slds-path__stage">
                            <lightning:icon iconName="utility:check" size="xx-small" />
                              <span class="slds-assistive-text">Stage Complete</span>
                           </span>
                           <span class="slds-path__title">Engineering</span>
                        </a>
                     </li>
                     <li class="slds-path__item slds-is-incomplete" role="presentation">
                        <a aria-controls="path-content-5" aria-expanded="true" aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-5" role="tab" tabindex="-1">
                           <span class="slds-path__stage">
                            <lightning:icon iconName="utility:check" size="xx-small" />
                              <span class="slds-assistive-text">Stage Complete</span>
                           </span>
                           <span class="slds-path__title">Product Marketing - Post Engineering</span>
                        </a>
                     </li>
                     <li class="slds-path__item slds-is-incomplete" role="presentation">
                        <a aria-controls="path-content-6" aria-expanded="true" aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-6" role="tab" tabindex="-1">
                           <span class="slds-path__stage">
                            <lightning:icon iconName="utility:check" size="xx-small" />
                              <span class="slds-assistive-text">Stage Complete</span>
                           </span>
                           <span class="slds-path__title">Business Segment Leader</span>
                        </a>
                     </li>
                     <li class="slds-path__item slds-is-incomplete" role="presentation">
                        <a aria-controls="path-content-7" aria-expanded="true" aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-7" role="tab" tabindex="-1">
                           <span class="slds-path__stage">
                            <lightning:icon iconName="utility:check" size="xx-small" />
                              <span class="slds-assistive-text">Stage Complete</span>
                           </span>
                           <span class="slds-path__title">Opportunity Owner</span>
                        </a>
                     </li>
                     <li class="slds-path__item slds-is-incomplete" role="presentation">
                        <a aria-controls="path-content-8" aria-expanded="true" aria-selected="true" class="slds-path__link" href="javascript:void(0);" id="path-8" role="tab" tabindex="0">
                           <span class="slds-path__stage">
                            <lightning:icon iconName="utility:check" size="xx-small" />
                              <span class="slds-assistive-text">Current Stage:</span>
                           </span>
                           <span class="slds-path__title">Closed</span>
                        </a>
                     </li>
         

                  </ul>
                  <div class="slds-path__scroll-controls">
                     <lightning:button class="slds-button slds-button_icon slds-button_icon-border-filled" title="Scroll left" tabindex="-1" onclick="{!c.popleft}">
                         <lightning:icon iconName="utility:chevronleft" size="xx-small" />
                        <span class="slds-assistive-text">Scroll left</span>
                     </lightning:button>
                     <lightning:button class="slds-button slds-button_icon slds-button_icon-border-filled" title="Scroll right" tabindex="-1" onclick="{!c.popright}">
                          <lightning:icon iconName="utility:chevronright" size="xx-small" />
                        <span class="slds-assistive-text">Scroll right</span>
                     </lightning:button>
                  </div>
               </div>
                
            </div>
         </div>
         <div class="slds-grid slds-path__action">
            <span class="slds-path__stage-name">Stage: Unqualified</span>
            <button class="slds-button slds-button_brand slds-path__mark-complete">
               Approval Pending
            </button>
         </div>
      </div>
    

</aura:component>

Lightning
({
	
  
    popright : function(component, event, helper){
        var inner = component.find("scroller_inner").getElement().innerHTML;
        console.log(inner);
        inner.scrollLeft -= 5;


    }
})

I have non-technical users updating picklist fields and custom settings, etc. Is there away via Salesforce DX I can listen for these changes in my production environment and sync them down into my Sandboxes? Is there a way I can automate this?
Hello,

I'm currently trying to find the best way to approach a request we have internally. I have inherited  custom Visualforce Community that has a custom search that is conducting a large SOSL search and rendering the results in VF and into a AngularJS controller. We have found that the JS remote call is very slow in rendering the results on page. So I have a few questions on how to optimize:

1) Would an API call be faster in fetching the results? Is there anything I can set in Salesforce to make this faster?

2) In general, are Lightning Components/Apps faster to render data on page? Would it make sense to refactor into a lightning component?

Apex
@RemoteAction
    global static List<SObject> getAllRecords (String language, String searchString, Boolean isSaved) {
        System.debug('>>> searchString = ' + searchString);
        List<SObject> records = new List<SObject>();
        String contentRecordTypeId = GlobalPRM_ManagementService.getRecordTypeId(GlobalPRM_ConstantDeclarations.CONTENT_RECORD_TYPE_RESOURCE, 'ContentVersion');
        
        String savedResourceIds = '';
        if (isSaved) {
            savedResourceIds = getSavedResourceIds();
             //Updated by JoJo 05/10/2016, If viewing saved only, but without saved resource, return empty records.             
               
             if (savedResourceIds == '' ) {
                 return records;
             }
        } 
        
        if (searchString == '') {
            String filter1 = '';
            if (savedResourceIds != '' ) {
                filter1 += ' AND Id IN ' + savedResourceIds;
            }
              System.debug('>>> filter1 = ' + filter1);
            records.addAll(GlobalPRM_ManagementService.getArticlesByFieldSet('Resource_Library__kav', 'GlobalPRM_ResourceLibraryArticle_FieldSe', language, filter1));
            String fieldNames = 'Title, Description, TagCsv, Brand__c, Type__c, Products__c, Solutions__c, Role__c, CreatedDate, LastModifiedDate, FileType';
            for(GlobalPRM_VisibilitySettings__c rec: GlobalPRM_VisibilitySettings__c.getAll().valueS()){
              fieldNames+=','+rec.source__c;
            }
            String filter2 = GlobalPRM_ManagementService.buildFilterForContent(language, 'RecordTypeId = \'' + contentRecordTypeId + '\'');
            if (savedResourceIds != '') {
                filter2 += ' AND Id IN ' + savedResourceIds;
            }
            System.debug('>>> filter2 = ' + filter2);
            records.addAll(GlobalPRM_ManagementService.queryListByFieldNames(fieldNames, 'ContentVersion', filter2));
        } else {
            String queryString = 'FIND \'' + searchString + '\' IN ALL FIELDS RETURNING ';
            String filter1 = GlobalPRM_ManagementService.buildFilterForArticle(language, '', 'Resource_Library__kav');
            String filter2 = GlobalPRM_ManagementService.buildFilterForContent(language, 'RecordTypeId = \'' + contentRecordTypeId + '\'');
            
            // 8/18/2016 Jade Global: This has been added to include customSetting Fields in Query and Visibility__c has been Removed from Query
            String visibilityFields = GlobalPRM_ManagementService.retQueryStringForCustomSettingFields('GlobalPRM_VisibilitySettings__c');
            
            if (savedResourceIds != '' ) {
                filter1 += ' AND Id IN ' + savedResourceIds;
                filter2 += ' AND Id IN ' + savedResourceIds;
            }
            queryString += 'Resource_Library__kav ('+visibilityFields+', Thumbnail__c, Heading__c, FirstPublishedDate, LastModifiedDate, Description__c, Products__c, Solutions__c, Brand__c, Type__c, Role__c, Tags__c, KnowledgeArticleId' + 
                           filter1 + '),' + 
                           ' ContentVersion ('+visibilityFields+' ,Title, Description, TagCsv, Brand__c, Type__c, Products__c, Solutions__c, Role__c, CreatedDate, LastModifiedDate, FileType' + 
                           filter2 + ')';
            System.debug('>>> queryString = ' + queryString);
            
            List<List<sObject>> results = search.query(queryString);
            for (Integer k = 0; k < results.size(); k++) {
                records.addAll(results[k]);
            }
        } 

       return GlobalPRM_ManagementService.filterByVisibilityPOC(records,null);
    }
    
    global static String getSavedResourceIds () {
        String savedResourceIds = '('; 
        
        String fieldNames = 'Id, Partner_User__c, Resource_ID__c';
        String filter = 'WHERE Partner_User__c = \'' + UserInfo.getUserId() + '\'';
        Set<String> articleNumberSet = new Set<String>();
        Set<String> contentDocumentSet = new Set<String>();

         //Updated by JoJo 05/10/2016, get ArticleNumber or ContentDocumentId by Resource_ID__c  
        for (Saved_Resource__c sr : (List<Saved_Resource__c>)GlobalPRM_ManagementService.queryListByFieldNames(fieldNames, 'Saved_Resource__c', filter)) {
             String resourceId = sr.Resource_ID__c;
            if(resourceId.length()==18){
                if(resourceId.startsWithIgnoreCase('069')){
                 //sr.Resource_ID__c  => Content Document Id          
                contentDocumentSet.add(sr.Resource_ID__c); 
                }else{
                    savedResourceIds += '\'' + sr.Resource_ID__c + '\', ';
                }
            }else{
                 //sr.Resource_ID__c  => ArticleNumber          
               articleNumberSet.add(sr.Resource_ID__c);
            }
        }
        //Get the knowledge articl id which publishStatus is online by ArticleNumber           
        KnowledgeArticleVersion[] kavList =[Select Id from KnowledgeArticleVersion where PublishStatus='online' and language='en_US' and ArticleNumber in :articleNumberSet];
        for (KnowledgeArticleVersion kav :kavList) {
         
           savedResourceIds += '\'' + kav.id + '\', ';
        }
        
       //Get the content version id which is the LatestPublishedVersionId  by content document id           
       ContentDocument[] cdList= [Select LatestPublishedVersionId From ContentDocument where id in :contentDocumentSet];
       for (ContentDocument cd :cdList) {
         
           savedResourceIds += '\'' + cd.LatestPublishedVersionId + '\', ';
        }
        
        if (savedResourceIds.length() == 1) {
            savedResourceIds = '';
        } else {
            savedResourceIds = savedResourceIds.substring(0, savedResourceIds.length() - 2);
            savedResourceIds += ')';
        }
        
        System.debug('>>>savedResourceIds' + savedResourceIds);
        return savedResourceIds;
    }

 
I'm running into an issue with an Action Function rerendering, but values do not appear. Upon selection of a country this should rerender the State section and the corresponding state values should appear. Instead I'm not seeing anything. This is working in VF API version 29, but not 40.

On the country field, onchange, it fires a function displayStates() which calls rerenderStates();. However, when rerender occurs, no state values appear. Any help would be appreciated.

Apex
public class complianceInquiryTool {
   
      
        objCase = new Case();
        objCase.RecordTypeId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('Compliance').getRecordTypeId();
        characters = new List<String>{'a','b','c','d','e','f','g','h',
        'i','j','k','l','m','n','o','p','q','r','s','t','u','v','w',
        'x','y','z','1','2','3','4','5','6','7','8','9','0'};
        useragent = ApexPages.currentPage().getHeaders().get('User-Agent');
        strLanguageCode = apexpages.currentpage().getparameters().get('lang'); 
        getCountriesSelectList();

    }
    public List<SelectOption> getCountriesSelectList(){
        options = new List<SelectOption>();
        options.add(new SelectOption('', 'Select Country'));
        
        // Find all the countries in the custom setting
        Map<String, Countries__c> countries = Countries__c.getAll(); 
        
        // Sort them by name
        List<String> countryNames = new List<String>();
        for(Countries__c cntry :countries.values()){
        
            countryNames.add(cntry.Country__c);
        }
        countryNames.sort();
        
        // Create the Select Options.
        for (String countryName : countryNames) {
            //Countries__c country = countries.get(countryName);
            //options.add(new SelectOption(country.Name, country.Country__c));
            options.add(new SelectOption(countryName, countryName));
        }        
        return options;   
    }
    
    public List<SelectOption> getStatesSelectList() {    
        List<SelectOption> options = new List<SelectOption>();
        // Find all the states we have in custom settings.
        Map<String, States__c> allstates = States__c.getAll();
        
        // Filter states that belong to the selected country
        Map<String, States__c> states = new Map<String, States__c>();
        for(States__c state : allstates.values()) {
            system.debug(this);
            if (state.Country__c == this.country) {
                states.put(state.Name, state);
            }
        }
        
        // Sort the states based on their names
        List<String> stateNames = new List<String>();
        stateNames.addAll(states.keySet());
        stateNames.sort();
        
        // Generate the Select Options based on the final sorted list
        for (String stateName : stateNames) {
            States__c state = states.get(stateName);
            options.add(new SelectOption(state.State__c, state.Name));
        }
        
        // If no states are found, just say not required in the dropdown.
        if (options.size() > 0) {
            options.add(0, new SelectOption('', '-- N/A --'));
        } else {
            options.add(new SelectOption('', system.label.Case_State_Not_Req));
            //options.add(new SelectOption('', 'Not Required'));
        }
        return options;
        }
        
        public Integer randomNumber(){
            Integer random = Math.Round(Math.Random() * characters.Size());
            if(random == characters.size()){
            random--;
        }
        return random;
    }
    
    public String getChar1(){
        char1 = characters[randomNumber()];
        secCode = char1;
        return char1;
    }
    public String getChar2(){
        Char2 = characters[randomNumber()];
        secCode += char2;
        return Char2;
    }
    public String getChar3(){
        char3 = characters[randomNumber()];
        secCode += char3;
        return char3;
    }
    public String getChar4(){
        char4 = characters[randomNumber()];
        secCode += char4;
        return char4;
    }
    public String getChar5(){
        char5 = characters[randomNumber()];
        secCode += char5;
        return char5;
    }
    public String getChar6(){
        char6 = characters[randomNumber()];
        secCode += char6;
        return char6;
    }
 public PageReference validate(){    
        if(input.length() == 6 && input.subString(0,1) == char1 && input.subString(1,2) == char2 && input.subString(2,3) == char3 && input.subString(3,4) == char4 && input.subString(4,5) == char5  && input.subString(5,6) == char6){
            // result = 'Whoohoo! You got it right.';
            return saveCase();             
        }else{
            //  result = 'Come on...the letters aren\'t matching the image.';
            return null; 
        }
    }
 public PageReference saveCase(){
      //  Datetime cDT = System.now();        
       // LongDate = cDT.format('EE MMM dd yyyy HH:mm:ss Z');
        Countries__c con = [SELECT Region__c From Countries__c Where Country__c =:country];
        PageReference pr = null;
        
        List<Contact> conList = new List<Contact>();
        conList = [SELECT Id FROM Contact WHERE Email =: email AND Phone =: objCase.Contact_Phone_Web__c AND Status__c = 'Active'];
        if(conList.size() == 1){        
            objCase.ContactId = conList[0].Id;        
        }
        
        objCase.Region__c = con.Region__c;
  
        objCase.SuppliedEmail = email;
        objCase.Subject = objCase.Description.abbreviate(20);
        objCase.Origin = 'Web Form: Compliance Tool'; 
        objCase.Description = 'Problem: '+ '\n \n' + 'First Name: '+ first_name + '\n' + 'Last Name: '+last_name+'\n'+ 'Title: '+ title + '\n' +  '\n' + 'Product: '+ objCase.Product__c + '\n'+ 'Model: ' + objCase.Model__c + '\n' + '\n' +
        'Company: '+ company +'\n' + 'City: '+city +'\n'; 
        if(State == null){
            State = '';
        }
        objCase.Description = objCase.Description + 'State: '+ State + '\n'+ 'Country: '+ country + '\n' + 'Region: '+ con.Region__c + '\n' + 'ZIP Code: '+ zipCode +'\n'+ 'Telephone: ' + objCase.Contact_Phone_Web__c +'\n'+ 'Fax: '+ fax+'\n'+'Email: '+email+'\n'+'Confirm Email: '+confirmEmail+'\n'+'Remedy Problem: ' +  + 'Submit Time: ' +  '\n'+ 'IP Address: '+ ipAddress + '\n' + 'User Agent: ' + useragent + '\n';
        
        if(objCase.Priority == null){
        objCase.Priority = '';
        }   
        
        objCase.Description = objCase.Description + 'Language: '+ objCase.Case_Language__c + '\n' + 'Product: '+ objCase.Product__c + '\n'+ 'Model: ' + objCase.Lumidigm_Part__c + '\n';      
                                     
      
        
        
            objCase.RecordTypeId = Schema.SObjectType.Price_Authorization_Form__c.getRecordTypeInfosByName().get('Compliance').getRecordTypeId();
        
        AssignmentRule AR = new AssignmentRule(); 
        AR = [select id from AssignmentRule where SobjectType = 'Case' and Active = true limit 1]; 

        if(AR != null){
            //Creating the DMLOptions for "Assign using active assignment rules" checkbox 
            Database.DMLOptions dmlOpts = new Database.DMLOptions();
            dmlOpts.EmailHeader.TriggerUserEmail = true; 
            dmlOpts.assignmentRuleHeader.assignmentRuleId= AR.id; 
            dmlOpts.EmailHeader.triggerAutoResponseEmail = true;
            objCase.setOptions(dmlOpts); 
            insert objCase;
            CaseNumber = [SELECT CaseNumber FROM Case where id =: objCase.Id].CaseNumber;
            //pr.getParameters().put('cid',objCase.id);
            pr = new PageReference('/apex/ThankYouPage' + '?cid=' + objCase.Id); 
        }       
        return pr;
    }  
    
}

Visualforce
<apex:page docType="html-5.0" standardStylesheets="false" 

    
    
 
 
</head>
<body>
  <apex:actionFunction name="rerenderStates" rerender="compTool" >
    <apex:param name="firstParam" assignTo="{!country}" value="" />
   </apex:actionFunction>
    
    <div class="container">

<div class="col-md-8">
    <div class="form-area">  

           
        <br style="clear:both"/>
                    <p style="margin-bottom: 25px; text-align: left;">Please let us know what product you need support with below:</p>
                    
                    <div class="alert alert-warning" id="alertz"  role="alert" style="display:none;" >
                    </div>
                    <div class="form-group">
                          <label class="">Nature of Request</label>

                             <span class="required">*</span>
                             <apex:inputField styleClass="form-control" id="nature"  html-placeholder="Nature of Request" value="{!objCase.Nature_of_Request__c}" required="true" /> 
                    

                    </div>
                        
                         <div class="form-group">
                          <label class="">{!$Label.Case_Language}</label>

                             <span class="required">*</span>
                             <apex:inputField styleClass="form-control" id="language" html-placeholder="{!$Label.Case_Language}" value="{!objCase.Case_Language__c}" required="true" /> 
                    

                    </div>
                             <div class="form-group ">
                             <label class="">Product Family</label>
                             <span class="required">*</span>
                             <apex:inputField styleClass="form-control " id="product" html-placeholder="Product Family" value="{!objCase.Product__c}" required="true" /> 
                    

                    </div>
                            
                              <div class="form-group ">
                                  <label class="">Model and P/N</label>
                                  <span class="required">*</span>
                                  <apex:inputField styleClass="form-control " id="model" html-placeholder="Model & PN" value="{!objCase.Lumidigm_Part__c}" required="true" /> 
                    

                    </div>
                           
       
                           
                    
                  
                    <div class="form-group">
                       <label class="">Please describe the problem you are having</label>
                        <span class="required">*</span>
                        <apex:inputTextarea styleClass="form-control " id="message" html-placeholder="Please describe the problem you are having:" rows="7"/>
                    </div>
                     <div>
                         <p>Tell us how we can reach you below:</p>
                     </div>
                     <div class="form-group ">
                      <label class="">{!$Label.conFirstName}</label>
                      <span class="required">*</span>
                      <apex:inputText id="first_name" styleClass="form-control" html-placeholder="{!$Label.conFirstName}" value="{!first_name}" required="true" />
                    </div> 
                      <div class="form-group ">
                       <label class="">{!$Label.conLastName}</label>
                      <span class="required">*</span>
                      <apex:inputText id="last_name" styleClass="form-control" html-placeholder="{!$Label.conLastName}" value="{!last_name}" required="true" />
                    </div>
                      <div class="form-group ">
                      <label class="">{!$Label.conTitle}</label>
                      <span class="required">*</span>
                      <apex:inputText id="title" styleClass="form-control" html-placeholder="{!$Label.conTitle}" value="{!title}" />
                    </div>
                      <div class="form-group ">
                      <label class="">{!$Label.conCompany}</label>
                      <span class="required">*</span>
                      <apex:inputText id="company" styleClass="form-control" html-placeholder="{!$Label.conCompany}" value="{!company}" />
                    </div>
                      <div class="form-group">
                       <label class="">{!$Label.conCity}</label>
                      <span class="required">*</span>
                      <apex:inputText id="city" styleClass="form-control" html-placeholder="{!$Label.conCity}" value="{!city}" />
                    </div>
                      <div class="form-group ">
                        <label class="">{!$Label.conCountry}</label>
                       <span class="required">*</span>
                       <apex:selectList styleClass="form-control" size="1" id="country" html-placeholder="{!$Label.conCountry}" value="{!country}" required="true" onchange="return displayStates(this.value);"> 
                         <apex:selectOptions value="{!options}"/>
                        </apex:selectList>

                    </div>
                         <apex:outputPanel id="statePanel">
                      <div class="form-group">
                        <label class="">State</label>                          
                      <span class="required" style="display:none;">*</span>
                      <apex:selectList styleClass="form-control" id="stateList" size="1" value="{!State}" >
                        <apex:selectOptions value="{!StatesSelectList}"/>
                      </apex:selectList>
                    </div>
                        </apex:outputPanel>
                        <div class="form-group">
                          <label class="">{!$Label.conPostalCode}</label>
                      <span class="required">*</span>
                      <apex:inputText id="zip" styleClass="form-control" html-placeholder="{!$Label.conPostalCode}" value="{!zipCode}" />
                    </div>
                      <div class="form-group ">
                       <label class="">Phone Number</label>
                       <span class="required">*</span>
                       <div class="input-group">
              			<span class="input-group-addon"><span class="glyphicon glyphicon-phone-alt" aria-hidden="true"></span></span>
              			<apex:inputText id="tel" styleClass="form-control" html-placeholder="Phone Number" value="{!phone}" required="" />
            			</div> 
                    </div> 
                       
                     <div class="form-group ">
                      <label class="">Email</label>
                      <span class="required">*</span>
                    <div class="input-group">
                      <span class="input-group-addon"><i class="glyphicon glyphicon-envelope" aria-hidden="true"></i></span>
                      <apex:inputText id="email" styleClass="form-control" html-placeholder="Email @" value="{!email}" required="true" />
                    </div>   
                       
                    </div>
                      <div class="form-group">
                      <label class="">Confirm Email</label>
                      <span class="required">*</span>
                    <div class="input-group">
                      <span class="input-group-addon"><i class="glyphicon glyphicon-envelope" aria-hidden="true"></i></span>
                      <apex:inputText id="confirmemail" styleClass="form-control" html-placeholder="Confirm Email @" value="{!confirmEmail}" required="true" />
                    </div>   
                       
                    </div>
                      <div class="form-group">
                                                  <label class="">Match Security Code</label>
                      <span class="required">*</span><div style="float: right;">
                  		<apex:outputPanel layout="block" styleClass="boxHolder" id="code">
                      	<apex:outputText value="{!char1}" styleClass="coolBlue"/>
                      	<apex:outputText value="{!char2}" styleClass="coolBlue"/>
                      	<apex:outputText value="{!char3}" styleClass="coolBlue"/>
                      	<apex:outputText value="{!char4}" styleClass="coolBlue"/>
                      	<apex:outputText value="{!char5}" styleClass="coolBlue"/>
                      	<apex:outputText value="{!char6}" styleClass="coolBlue"/>
                        </apex:outputPanel>
                         </div>
                      
                      <apex:inputText styleClass="form-control" id="secuCode" html-placeholder="Match Security Code" value="{!input}" style="float:left;"/>
                          

                          </div>
                    
                             
        
                    
            
                <center> 
                <apex:commandButton styleClass="btn btn-primary pull-right" id="submit" value="Submit" onclick="validateEmail()">
                    <apex:actionFunction name="callValidate" action="{!validate}" />
                </apex:commandButton>
                </center>
                    
        

    </div>
</div>
                </div>
                    </body>
                    </apex:form>
                <script>
       

    		function validateEmail() {           
            var emailText = document.getElementById('{!$Component.compTool:email}').value;           
            var pattern = /^[a-zA-Z0-9\-_]+(\.[a-zA-Z0-9\-_]+)*@[a-z0-9]+(\-[a-z0-9]+)*(\.[a-z0-9]+(\-[a-z0-9]+)*)*\.[a-z]{2,4}$/;
                var droptext = document.createElement('p');
                droptext.innerHTML="{!$Label.conEmailmessage}" + emailText ;
                var alertGrab = document.getElementById('alertz');
            if (emailText != ''){
                if (pattern.test(emailText)) {
                    confirmEmail();
                } else {
				alertGrab.appendChild(droptext);
                 alertGrab.style.display="block";
                }
            }else{
                validate();
                 
            } 
            //validate();            
            return false;
        }

    function confirmEmail(){
            var email = document.getElementById('{!$Component.tktForm:email}').value;
            var confEmail = document.getElementById('{!$Component.tktForm:confEmail}').value;
       	    var droptext = document.createElement('p');
                droptext.innerHTML="{!$Label.conEmailmessage2}" + emailText ;
            var alertGrab = document.getElementById('alertz');
           
            if(email != confEmail){ 
                alertGrab.appendChild(droptext);
                 alertGrab.style.display="block";
                return false;        
            }else{                
                validate();                
            }
            return false;
        }
    function displayStates(selcntry){
            console.log(selcntry);
           setStatelanguage();
            rerenderStates(selcntry);
            return false;
        }
    


                    </script>
    
</apex:page>



 
Hello,

I'm trying to query attachments associated to a 'published' version of a record and clone the record and the attachment. So far I've been able to clone the record, but I can't get the attachment to relate to the new record. I'm doing this in a class that I'm using in a trigger.
 
public void updateDraftRecord(Map<Id,Partner_Locator_Detail__c> newMap){
        List<Partner_Locator_Detail__c> ptr = [SELECT Id, Name, Partner_Account__c,Publication_Status__c FROM Partner_Locator_Detail__c WHERE Publication_Status__c = 'Published' ];
	 
        Map<Id, Partner_Locator_Detail__c> acctPldMap = new Map<Id, Partner_Locator_Detail__c>();
         for(Partner_Locator_Detail__c pld:ptr){
            acctPldMap.put(pld.Partner_Account__c, pld);
        }
         system.debug(acctPldMap);
        
       // List<Attachment> atc = [SELECT Id, Name, ParentID FROM Attachment WHERE ParentID IN :acctPldMap.values()];
        
       // Map<Id, Attachment> attachMap = new Map<Id, Attachment>();
     
        List<Business_Segment__c> biz = [SELECT Id, Advantage_Partner_Program_Tier__c,Applications_Usage__c,Business_Segment__c,Field_Embedded_Images__c,Field_Product_Image__c,Field_Product_Image2__c,Field_Product_Image2_Timestamp__c,	Field_Product_Image_Timestamp__c,Industries__c,Partner_Type__c,	Product_Portfolio_Alternate_Text__c,Product_Portfolio_Title__c,Products__c,	Regions__c,	Segment_Overview__c,Segment_Headline__c, Partner_Locator_Detail__c FROM Business_Segment__c WHERE Partner_Locator_Detail__c IN :acctPldMap.values() ];
          Map<Id, Business_Segment__c> ptrBizMap = new Map<Id, Business_Segment__c>();
          system.debug(ptrBizMap);
         
         for(Business_Segment__c bizSeg: biz){
            ptrBizMap.put(bizSeg.Partner_Locator_Detail__c, bizSeg);
        }
         system.debug(ptrBizMap);
        List<Attachment> bizAttach = [SELECT Id,Body,BodyLength,ContentType,Description, Name, ParentID FROM Attachment WHERE ParentID IN :ptrBizMap.values()];
         system.debug(bizAttach);
         Map<Id, Attachment> bizAttachMap = new Map<Id, Attachment>();
         for(Attachment attach: bizAttach){
             bizAttachMap.put(attach.ParentId, attach);
         }
         system.debug(bizAttachMap.values());
		List<Business_Segment__c> bizSegInsert = new List<Business_Segment__c>();
		List<Attachment> attachmentToInsert = new List<Attachment>();
        for(Partner_Locator_Detail__c psd : newMap.values()){
            if(acctPldMap.containsKey(psd.Partner_Account__c) && psd.Publication_Status__c=='Draft' && psd.isClone()){
                if(ptrBizMap.size() >0 && ptrBizMap.containsKey(acctPldMap.get(psd.Partner_Account__c).id)){
                    Business_Segment__c bizs = ptrBizMap.get(acctPldMap.get(psd.Partner_Account__c).id);
                    Business_Segment__c bizClone = bizs.clone(false,true);
                   
                    bizClone.Partner_Locator_Detail__c = psd.id;
                    BizSegInsert.add(bizClone);
                    if(psd.Partner_Account__c !=null){
                        if(ptrBizMap.get(psd.Partner_Account__c) != null ){
                     if(bizAttachMap.size() > 0 && bizAttachMap.containsKey(ptrBizMap.get(psd.Partner_Account__c).Id)){
                    	Attachment biza = bizAttachMap.get(ptrBizMap.get(psd.Partner_Account__c).Id);
                         system.debug(biza);
                        Attachment bizaClone = biza.clone(false,true);
                        bizaClone.ParentId = psd.id;
                        attachmentToInsert.add(bizaClone);
                	} 
                        }
                    }
                }
                
            }
            
        }
         if(BizSegInsert !=null && BizSegInsert.size()>0){
             insert BizSegInsert;
         }
         if(attachmentToInsert !=null && attachmentToInsert.size() > 0){
             insert attachmentToInsert;
         }
        
    }

It starts to fall apart when I try to generate a map of the attachment ids here:
List<Attachment> bizAttach = [SELECT Id,Body,BodyLength,ContentType,Description, Name, ParentID FROM Attachment WHERE ParentID IN :ptrBizMap.values()];
         system.debug(bizAttach);
         Map<Id, Attachment> bizAttachMap = new Map<Id, Attachment>();
         for(Attachment attach: bizAttach){
             bizAttachMap.put(attach.ParentId, attach);
         }



Debug log:
10:23:33.0 (1097819166)|METHOD_ENTRY|[17]|01p34000000tOfg|GlobalPRM_PartnerLocatorTriggerHelper.updateDraftRecord(Map<Id,Partner_Locator_Detail__c>) 10:23:33.0 (1107909785)|SOQL_EXECUTE_BEGIN|[36]|Aggregations:0|SELECT Id, Name, Partner_Account__c, Publication_Status__c FROM Partner_Locator_Detail__c WHERE Publication_Status__c = 'Published' 10:23:33.0 (1116469314)|SOQL_EXECUTE_END|[36]|Rows:230 10:23:33.0 (1145927691)|SOQL_EXECUTE_BEGIN|[48]|Aggregations:0|SELECT Id, Advantage_Partner_Program_Tier__c, Applications_Usage__c, Business_Segment__c, Field_Embedded_Images__c, Field_Product_Image__c, Field_Product_Image2__c, Field_Product_Image2_Timestamp__c, Field_Product_Image_Timestamp__c, Industries__c, Partner_Type__c, Product_Portfolio_Alternate_Text__c, Product_Portfolio_Title__c, Products__c, Regions__c, Segment_Overview__c, Segment_Headline__c, Partner_Locator_Detail__c FROM Business_Segment__c WHERE Partner_Locator_Detail__c IN :tmpVar1 10:23:33.0 (1333273631)|SOQL_EXECUTE_END|[48]|Rows:410 10:23:33.0 (1385104076)|SOQL_EXECUTE_BEGIN|[56]|Aggregations:0|SELECT Id, Body, BodyLength, ContentType, Description, Name, ParentID FROM Attachment WHERE ParentID IN :tmpVar1 10:23:34.102 (2102263073)|SOQL_EXECUTE_END|[56]|Rows:17 10:23:34.102 (2108363986)|DML_BEGIN|[90]|Op:Insert|Type:Business_Segment__c|Rows:1 10:23:34.102 (2139209464)|DML_END|[90]


 
Hello,
I'm trying to query attachments and add an attachment to a custom business segment object. I'm getting a null pointer exception when trying to retrieve te value from an attachment map. Any ideas on how to optimize/fix? In the debugger the map is populated with values, but I'm still getting an exception.

The error hits at this line:
if(bizAttachMap.size() > 0 && bizAttachMap.containsKey(ptrBizMap.get(psd.Partner_Account__c).Id))


Thanks.
Map<Id, Attachment> bizAttachMap = new Map<Id, Attachment>();
         for(Attachment attach: bizAttach){
             bizAttachMap.put(attach.ParentId, attach);
         }
         system.debug(bizAttachMap.values());
		List<Business_Segment__c> bizSegInsert = new List<Business_Segment__c>();
		List<Attachment> attachmentToInsert = new List<Attachment>();
        for(Partner_Locator_Detail__c psd : newMap.values()){
            if(acctPldMap.containsKey(psd.Partner_Account__c) && psd.Publication_Status__c=='Draft' && psd.isClone()){
                if(ptrBizMap.size() >0 && ptrBizMap.containsKey(acctPldMap.get(psd.Partner_Account__c).id)){
                    Business_Segment__c bizs = ptrBizMap.get(acctPldMap.get(psd.Partner_Account__c).id);
                    Business_Segment__c bizClone = bizs.clone(false,true);
                   
                    bizClone.Partner_Locator_Detail__c = psd.id;
                    BizSegInsert.add(bizClone);
                     if(bizAttachMap.size() > 0 && bizAttachMap.containsKey(ptrBizMap.get(psd.Partner_Account__c).Id)){
                    	Attachment biza = bizAttachMap.get(ptrBizMap.get(psd.Partner_Account__c).Id);
                        Attachment bizaClone = biza.clone(false,true);
                        bizaClone.ParentId = psd.id;
                        attachmentToInsert.add(bizaClone);
                	}
                    
                }
                
            }
            
        }
         if(BizSegInsert !=null && BizSegInsert.size()>0){
             insert BizSegInsert;
         }
         if(attachmentToInsert !=null && attachmentToInsert.size() > 0){
             insert attachmentToInsert;
         }


 
Hello all,

I have a link that I want passed to a String Variable in the Controller onclick. I'm failing at accomplishing this. Any help would be useful.

Visualforce
 
<apex:form >
             
    <apex:actionRegion >
    <apex:actionFunction name="setLink" action="{!makeLink}" reRender="link">
        <apex:param name="param1" assignTo="{!setLink}" value="" />
      </apex:actionFunction>
    </apex:actionRegion>
      
</apex:form>  
<a id="downloadContent" href="{!$Site.Prefix}/sfc/servlet.shepherd/version/download/{!con.Id}" onclick="setLink()"><i class="fa fa-download"></i></a>

Apex
public String linkClick{
     get;set;
        
    }
    
    public PageReference makeLink(){
        return null;
        
    }

 
I'm trying to use the Lighting Path with Coach Class and get the scrollable arrows to work.  However, I can't set scrollable attribute on the inner div and I get this error:
 
Action failed: c:opportunityApprovalHistoryLightning$controller$popright [Cannot create property 'scrollLeft' on string '

How can I make the Chevon left right buttons scroll the div view appropriately? Here is the link to the LDS item I using for further context. I just want to be able to scroll left and right using the buttons.
User-added image

Lightning Component
<aura:component controller="opportunityApprovalHistoryLightning" implements="lightning:actionOverride,force:hasRecordId,flexipage:availableForAllPageTypes" access="Global" >

 <lightning:layout horizontalAlign="center" multipleRows="true">
     <lightning:layoutItem flexibility="grow" size="12" padding="around-small">
    <lightning:buttonGroup >
       <lightning:button label="Submit for Approval" variant="brand" class="slds-m-top_medium" onclick="
            <div class="slds-path__scroller" role="application" aura:id = "scroller_outer">
                
               <div class="slds-path__scroller_inner" aura:id = "scroller_inner">
                  <ul class="slds-path__nav" role="tablist">
                     <li class="slds-path__item slds-is-incomplete" role="presentation">
                        <a aria-controls="path-content-1" aria-expanded="true" aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-1" role="tab" tabindex="-1">
                           <span class="slds-path__stage">
                             <lightning:icon iconName="utility:check" size="xx-small" />
                              <!--<span class="slds-assistive-text">Stage Complete</span>-->
                           </span>
                           <span class="slds-path__title">Sales Manager</span>
                        </a>
                     </li>
                     <li class="slds-path__item slds-is-incomplete " role="presentation">
                        <a aria-controls="path-content-2" aria-expanded="true" aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-2" role="tab" tabindex="-1">
                           <span class="slds-path__stage">
                              <lightning:icon iconName="utility:check" size="xx-small" />
                              <span class="slds-assistive-text">Stage Complete</span>
                           </span>
                           <span class="slds-path__title">Regional Segment Director</span>
                        </a>
                     </li>
                     <li class="slds-path__item slds-is-incomplete " role="presentation">
                        <a aria-controls="path-content-3" aria-expanded="true" aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-3" role="tab" tabindex="-1">
                           <span class="slds-path__stage">
                             <lightning:icon iconName="utility:check" size="xx-small" />
                              <span class="slds-assistive-text">Stage Complete</span>
                           </span>
                           <span class="slds-path__title">Product Marketing </span>
                        </a>
                     </li>
                     <li class="slds-path__item slds-is-incomplete" role="presentation">
                        <a aria-controls="path-content-4" aria-expanded="true" aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-4" role="tab" tabindex="-1">
                           <span class="slds-path__stage">
                            <lightning:icon iconName="utility:check" size="xx-small" />
                              <span class="slds-assistive-text">Stage Complete</span>
                           </span>
                           <span class="slds-path__title">Engineering</span>
                        </a>
                     </li>
                     <li class="slds-path__item slds-is-incomplete" role="presentation">
                        <a aria-controls="path-content-5" aria-expanded="true" aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-5" role="tab" tabindex="-1">
                           <span class="slds-path__stage">
                            <lightning:icon iconName="utility:check" size="xx-small" />
                              <span class="slds-assistive-text">Stage Complete</span>
                           </span>
                           <span class="slds-path__title">Product Marketing - Post Engineering</span>
                        </a>
                     </li>
                     <li class="slds-path__item slds-is-incomplete" role="presentation">
                        <a aria-controls="path-content-6" aria-expanded="true" aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-6" role="tab" tabindex="-1">
                           <span class="slds-path__stage">
                            <lightning:icon iconName="utility:check" size="xx-small" />
                              <span class="slds-assistive-text">Stage Complete</span>
                           </span>
                           <span class="slds-path__title">Business Segment Leader</span>
                        </a>
                     </li>
                     <li class="slds-path__item slds-is-incomplete" role="presentation">
                        <a aria-controls="path-content-7" aria-expanded="true" aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-7" role="tab" tabindex="-1">
                           <span class="slds-path__stage">
                            <lightning:icon iconName="utility:check" size="xx-small" />
                              <span class="slds-assistive-text">Stage Complete</span>
                           </span>
                           <span class="slds-path__title">Opportunity Owner</span>
                        </a>
                     </li>
                     <li class="slds-path__item slds-is-incomplete" role="presentation">
                        <a aria-controls="path-content-8" aria-expanded="true" aria-selected="true" class="slds-path__link" href="javascript:void(0);" id="path-8" role="tab" tabindex="0">
                           <span class="slds-path__stage">
                            <lightning:icon iconName="utility:check" size="xx-small" />
                              <span class="slds-assistive-text">Current Stage:</span>
                           </span>
                           <span class="slds-path__title">Closed</span>
                        </a>
                     </li>
         

                  </ul>
                  <div class="slds-path__scroll-controls">
                     <lightning:button class="slds-button slds-button_icon slds-button_icon-border-filled" title="Scroll left" tabindex="-1" onclick="{!c.popleft}">
                         <lightning:icon iconName="utility:chevronleft" size="xx-small" />
                        <span class="slds-assistive-text">Scroll left</span>
                     </lightning:button>
                     <lightning:button class="slds-button slds-button_icon slds-button_icon-border-filled" title="Scroll right" tabindex="-1" onclick="{!c.popright}">
                          <lightning:icon iconName="utility:chevronright" size="xx-small" />
                        <span class="slds-assistive-text">Scroll right</span>
                     </lightning:button>
                  </div>
               </div>
                
            </div>
         </div>
         <div class="slds-grid slds-path__action">
            <span class="slds-path__stage-name">Stage: Unqualified</span>
            <button class="slds-button slds-button_brand slds-path__mark-complete">
               Approval Pending
            </button>
         </div>
      </div>
    

</aura:component>

Lightning
({
	
  
    popright : function(component, event, helper){
        var inner = component.find("scroller_inner").getElement().innerHTML;
        console.log(inner);
        inner.scrollLeft -= 5;


    }
})

Hello,

I'm currently trying to find the best way to approach a request we have internally. I have inherited  custom Visualforce Community that has a custom search that is conducting a large SOSL search and rendering the results in VF and into a AngularJS controller. We have found that the JS remote call is very slow in rendering the results on page. So I have a few questions on how to optimize:

1) Would an API call be faster in fetching the results? Is there anything I can set in Salesforce to make this faster?

2) In general, are Lightning Components/Apps faster to render data on page? Would it make sense to refactor into a lightning component?

Apex
@RemoteAction
    global static List<SObject> getAllRecords (String language, String searchString, Boolean isSaved) {
        System.debug('>>> searchString = ' + searchString);
        List<SObject> records = new List<SObject>();
        String contentRecordTypeId = GlobalPRM_ManagementService.getRecordTypeId(GlobalPRM_ConstantDeclarations.CONTENT_RECORD_TYPE_RESOURCE, 'ContentVersion');
        
        String savedResourceIds = '';
        if (isSaved) {
            savedResourceIds = getSavedResourceIds();
             //Updated by JoJo 05/10/2016, If viewing saved only, but without saved resource, return empty records.             
               
             if (savedResourceIds == '' ) {
                 return records;
             }
        } 
        
        if (searchString == '') {
            String filter1 = '';
            if (savedResourceIds != '' ) {
                filter1 += ' AND Id IN ' + savedResourceIds;
            }
              System.debug('>>> filter1 = ' + filter1);
            records.addAll(GlobalPRM_ManagementService.getArticlesByFieldSet('Resource_Library__kav', 'GlobalPRM_ResourceLibraryArticle_FieldSe', language, filter1));
            String fieldNames = 'Title, Description, TagCsv, Brand__c, Type__c, Products__c, Solutions__c, Role__c, CreatedDate, LastModifiedDate, FileType';
            for(GlobalPRM_VisibilitySettings__c rec: GlobalPRM_VisibilitySettings__c.getAll().valueS()){
              fieldNames+=','+rec.source__c;
            }
            String filter2 = GlobalPRM_ManagementService.buildFilterForContent(language, 'RecordTypeId = \'' + contentRecordTypeId + '\'');
            if (savedResourceIds != '') {
                filter2 += ' AND Id IN ' + savedResourceIds;
            }
            System.debug('>>> filter2 = ' + filter2);
            records.addAll(GlobalPRM_ManagementService.queryListByFieldNames(fieldNames, 'ContentVersion', filter2));
        } else {
            String queryString = 'FIND \'' + searchString + '\' IN ALL FIELDS RETURNING ';
            String filter1 = GlobalPRM_ManagementService.buildFilterForArticle(language, '', 'Resource_Library__kav');
            String filter2 = GlobalPRM_ManagementService.buildFilterForContent(language, 'RecordTypeId = \'' + contentRecordTypeId + '\'');
            
            // 8/18/2016 Jade Global: This has been added to include customSetting Fields in Query and Visibility__c has been Removed from Query
            String visibilityFields = GlobalPRM_ManagementService.retQueryStringForCustomSettingFields('GlobalPRM_VisibilitySettings__c');
            
            if (savedResourceIds != '' ) {
                filter1 += ' AND Id IN ' + savedResourceIds;
                filter2 += ' AND Id IN ' + savedResourceIds;
            }
            queryString += 'Resource_Library__kav ('+visibilityFields+', Thumbnail__c, Heading__c, FirstPublishedDate, LastModifiedDate, Description__c, Products__c, Solutions__c, Brand__c, Type__c, Role__c, Tags__c, KnowledgeArticleId' + 
                           filter1 + '),' + 
                           ' ContentVersion ('+visibilityFields+' ,Title, Description, TagCsv, Brand__c, Type__c, Products__c, Solutions__c, Role__c, CreatedDate, LastModifiedDate, FileType' + 
                           filter2 + ')';
            System.debug('>>> queryString = ' + queryString);
            
            List<List<sObject>> results = search.query(queryString);
            for (Integer k = 0; k < results.size(); k++) {
                records.addAll(results[k]);
            }
        } 

       return GlobalPRM_ManagementService.filterByVisibilityPOC(records,null);
    }
    
    global static String getSavedResourceIds () {
        String savedResourceIds = '('; 
        
        String fieldNames = 'Id, Partner_User__c, Resource_ID__c';
        String filter = 'WHERE Partner_User__c = \'' + UserInfo.getUserId() + '\'';
        Set<String> articleNumberSet = new Set<String>();
        Set<String> contentDocumentSet = new Set<String>();

         //Updated by JoJo 05/10/2016, get ArticleNumber or ContentDocumentId by Resource_ID__c  
        for (Saved_Resource__c sr : (List<Saved_Resource__c>)GlobalPRM_ManagementService.queryListByFieldNames(fieldNames, 'Saved_Resource__c', filter)) {
             String resourceId = sr.Resource_ID__c;
            if(resourceId.length()==18){
                if(resourceId.startsWithIgnoreCase('069')){
                 //sr.Resource_ID__c  => Content Document Id          
                contentDocumentSet.add(sr.Resource_ID__c); 
                }else{
                    savedResourceIds += '\'' + sr.Resource_ID__c + '\', ';
                }
            }else{
                 //sr.Resource_ID__c  => ArticleNumber          
               articleNumberSet.add(sr.Resource_ID__c);
            }
        }
        //Get the knowledge articl id which publishStatus is online by ArticleNumber           
        KnowledgeArticleVersion[] kavList =[Select Id from KnowledgeArticleVersion where PublishStatus='online' and language='en_US' and ArticleNumber in :articleNumberSet];
        for (KnowledgeArticleVersion kav :kavList) {
         
           savedResourceIds += '\'' + kav.id + '\', ';
        }
        
       //Get the content version id which is the LatestPublishedVersionId  by content document id           
       ContentDocument[] cdList= [Select LatestPublishedVersionId From ContentDocument where id in :contentDocumentSet];
       for (ContentDocument cd :cdList) {
         
           savedResourceIds += '\'' + cd.LatestPublishedVersionId + '\', ';
        }
        
        if (savedResourceIds.length() == 1) {
            savedResourceIds = '';
        } else {
            savedResourceIds = savedResourceIds.substring(0, savedResourceIds.length() - 2);
            savedResourceIds += ')';
        }
        
        System.debug('>>>savedResourceIds' + savedResourceIds);
        return savedResourceIds;
    }