• VPM 1
  • NEWBIE
  • 15 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 9
    Replies
Has anyone worked on an Batch Class which converts leads. If yes please send me sample code
  • March 24, 2021
  • Like
  • 0
Need help with bulk lead conversion issue. Lead records are pushed into Salesforce by Mulesoft through Heroku Integration. We have Apex logic in Salesforce which converts the lead to Person Account and Opportunity if the Lead type__c = 'Consumer'. Logic works fine with single records however when leads are pushed in bulk by Mulesoft into Salesforce some lead are converted and some are not. (Even if the  type__c = 'Consumer'). I have bulkified my code however still I see this behaviour. Doesnt work through Dataloader as well. 

Please check the code and suggest if there is a better way to handle bullk lead conversion. 
public class ConsumerRulesHelper {
public static boolean isfirsttime = true;

        public static void handleleadconv(list < Lead > ldlist, Map < Id, Lead > oldMap) {

            List < Opportunity > listofOpp = new list < Opportunity > ();
            List < Lead > afterupleads = new list < Lead > ();
            List <Account> listofaccs = new list <Account> ();
            List < Marketing_Sales_Interaction__c > msilist = new list < Marketing_Sales_Interaction__c > ();
            Set<Id> leadIds = new Set<Id>();
            List<Vehicle_Relationship__c> VRList = new list<Vehicle_Relationship__c> ();
                if (!ldlist.isEmpty() ) {
                    for (Lead Lds: ldlist) {
                        if (oldMap != null && !oldMap.isEmpty() && oldMap.containsKey(Lds.id)) {
                            Lead ld = new Lead();
                             ld.id = Lds.id;
                                if(Lds.type__c == 'Consumer'){
                                   ld.type__c = 'Consumer';
                                                                }
                             if (oldMap.get(Lds.id).consumerid__c != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.consumerid__c = oldMap.get(Lds.id).consumerid__c;
                              }
                          if (oldMap.get(Lds.id).consumerLanguage__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.consumerLanguage__c = oldMap.get(Lds.id).consumerLanguage__c;
                          }
                          if (oldMap.get(Lds.id).globalConsumerId__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.globalConsumerId__c = oldMap.get(Lds.id).globalConsumerId__c;
                          }
                          if (oldMap.get(Lds.id).market__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.market__c = oldMap.get(Lds.id).market__c;
                          }
                          if (oldMap.get(Lds.id).additionalName__c != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.additionalName__c = oldMap.get(Lds.id).additionalName__c;
                          }
                          if (oldMap.get(Lds.id).dateOfBirth__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.dateOfBirth__c = oldMap.get(Lds.id).dateOfBirth__c;
                          }
                          if (oldMap.get(Lds.id).employer__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.employer__c = oldMap.get(Lds.id).employer__c;
                          }
                            if (oldMap.get(Lds.id).FirstName != null && UserInfo.getName() == 'Heroku Integration' ) {
                                ld.FirstName = oldMap.get(Lds.id).FirstName;
                            }
                          if (oldMap.get(Lds.id).gender__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.gender__c = oldMap.get(Lds.id).gender__c;
                          }
                          if (oldMap.get(Lds.id).maritalStatus__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.maritalStatus__c = oldMap.get(Lds.id).maritalStatus__c;
                          }
                          if (oldMap.get(Lds.id).occupation__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.occupation__c = oldMap.get(Lds.id).occupation__c;
                          }
                          if (oldMap.get(Lds.id).MiddleName != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.MiddleName = oldMap.get(Lds.id).MiddleName;
                          }
                          if (oldMap.get(Lds.id).LastName != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.LastName = oldMap.get(Lds.id).LastName;
                          }
                          if (oldMap.get(Lds.id).Title != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.Title = oldMap.get(Lds.id).Title;
                          }
                          if (oldMap.get(Lds.id).deceased__c != false && UserInfo.getName() == 'Heroku Integration') {
                            ld.deceased__c = oldMap.get(Lds.id).deceased__c;
                          }
                          if (oldMap.get(Lds.id).active__c != false && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.active__c = oldMap.get(Lds.id).active__c;
                          }
                          if (oldMap.get(Lds.id).addressLine1__c != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.addressLine1__c = oldMap.get(Lds.id).addressLine1__c;
                          }
                          if (oldMap.get(Lds.id).addressLine2__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.addressLine2__c = oldMap.get(Lds.id).addressLine2__c;
                          }
                          if (oldMap.get(Lds.id).addressLine3__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.addressLine3__c = oldMap.get(Lds.id).addressLine3__c;
                          }
                          if (oldMap.get(Lds.id).addressLine4__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.addressLine4__c = oldMap.get(Lds.id).addressLine4__c;
                          }
                          if (oldMap.get(Lds.id).district__c != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.district__c = oldMap.get(Lds.id).district__c;
                          }
                          if (oldMap.get(Lds.id).city__c != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.city__c = oldMap.get(Lds.id).city__c;
                          }
                          if (oldMap.get(Lds.id).country__c != null  && UserInfo.getName() == 'Heroku Integration') {
                            ld.country__c = oldMap.get(Lds.id).country__c;
                          }
                          if (oldMap.get(Lds.id).main__c != false && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.main__c = oldMap.get(Lds.id).main__c;
                          }
                          if (oldMap.get(Lds.id).postalCodeNumber__c != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.postalCodeNumber__c = oldMap.get(Lds.id).postalCodeNumber__c;
                          }
                          if (oldMap.get(Lds.id).primaryKey__c != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.primaryKey__c = oldMap.get(Lds.id).primaryKey__c;
                          }
                              afterupleads.add(ld);
                            
          if (Lds.type__c != 'Consumer' && oldMap.get(Lds.id).Status == 'Inactive' && Lds.Lead_Source_Most_Recent_Source__c == 'CDB' ) {
                  Marketing_Sales_Interaction__c msi = new Marketing_Sales_Interaction__c(Lead__c = Lds.Id);
                  msilist.add(msi);
        }          
                    }
        if (Lds.type__c == 'Consumer' && !Lds.IsConverted) {       
          Database.LeadConvert lc = new database.LeadConvert();
          lc.setLeadId(Lds.id);
          lc.ConvertedStatus = 'Qualified';

          Database.LeadConvertResult lcr = Database.convertLead(lc);
          System.assert(lcr.isSuccess());
          System.Debug(lcr);
          system.debug('convertedleadID: ' +lcr.getLeadId());    
          Account accs = new Account(id = lcr.accountid, PersonBirthdate = Lds.dateOfBirth__c);
          listofaccs.add(accs); 
            
          //Set Opportunity to closed won.
          Opportunity opp = new Opportunity(id = lcr.opportunityid, StageName = 'Closed Won', CampaignId = Label.Campaign_Id);
          //update opp;
          listofOpp.add(opp);

          //Create Interaction Record
          Marketing_Sales_Interaction__c msi = new Marketing_Sales_Interaction__c(Account__c = lcr.AccountId);
          msilist.add(msi);

        }

    }
                for (Integer i = 0; i < ldlist.size(); i++){
                if (ldlist[i].IsConverted == true ){      
                for (Lead lead : ldlist){
                if(oldMap.get(lead.id).isConverted == false ){
                leadIds.add(lead.Id);
                }
            }
        }
}

Map<Id, Vehicle_Relationship__c> mapVR = new Map<Id, Vehicle_Relationship__c>([select Id, Primary_Driver__c,convertedcontactid__c, Lead__c from Vehicle_Relationship__c where lead__c in :leadIds]);      
        if(!ldlist.isEmpty()) {
            for (Lead lead : ldlist)  {
                for (Vehicle_Relationship__c vr : mapVR.values()) {
                    if (vr.Lead__c == lead.Id) {                      
                        vr.Primary_Driver__c = vr.convertedcontactid__c;
                       
                        VRList.add(vr);
                    }
                }
            }
        }
    }

    if (VRList != null && !VRList.isEmpty()) {
          Update VRList;
    }
    if(listofaccs!= null && !listofaccs.isEmpty()){
         update listofaccs;
     }        
    if (listofOpp != null && !listofOpp.isEmpty()) {
      Update listofOpp;
    }
    if (msilist != null && !msilist.isEmpty()) {
      insert msilist;
    }
    if (afterupleads != null && !afterupleads.isEmpty()) {
      Update afterupleads;
    }
  }
  
public static void handlepaccountupdation(list < Account > perAcclist, Map < Id, Account > oldMapperAcc) {

  List < Opportunity > listofOpp = new list < Opportunity > ();
  List < Opportunity > listofOppCreate = new list < Opportunity > ();
  List < Account > afteruppc = new list < Account > ();
  if (!perAcclist.isEmpty() ) {
      for (Account pacc: perAcclist) {
        if ( oldMapperAcc != null && !oldMapperAcc.isEmpty() && oldMapperAcc.containsKey(pacc.id)) {
          Account accp = new Account();
          accp.id = pacc.id;
          if (oldMapperAcc.get(pacc.id).consumerId__c != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.consumerId__c = oldMapperAcc.get(pacc.id).consumerId__c;
          }
          if (oldMapperAcc.get(pacc.id).consumerLanguage__c != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.consumerLanguage__c = oldMapperAcc.get(pacc.id).consumerLanguage__c;
          }
          if (oldMapperAcc.get(pacc.id).globalConsumerId__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.globalConsumerId__c = oldMapperAcc.get(pacc.id).globalConsumerId__c;
          }
          if (oldMapperAcc.get(pacc.id).MC_Business_Unit__c != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.MC_Business_Unit__c = oldMapperAcc.get(pacc.id).MC_Business_Unit__c;
          }
          if (oldMapperAcc.get(pacc.id).PersonBirthdate != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.PersonBirthdate = oldMapperAcc.get(pacc.id).PersonBirthdate;
          }
          if (oldMapperAcc.get(pacc.id).employer__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.employer__c = oldMapperAcc.get(pacc.id).employer__c;
          }
          if (oldMapperAcc.get(pacc.id).FirstName != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.FirstName = oldMapperAcc.get(pacc.id).FirstName;
          }
          if (oldMapperAcc.get(pacc.id).Gender__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.Gender__c = oldMapperAcc.get(pacc.id).Gender__c;
          }
          if (oldMapperAcc.get(pacc.id).maritalStatus__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.maritalStatus__c = oldMapperAcc.get(pacc.id).maritalStatus__c;
          }
          if (oldMapperAcc.get(pacc.id).occupation__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.occupation__c = oldMapperAcc.get(pacc.id).occupation__c;
          }
          if (oldMapperAcc.get(pacc.id).MiddleName != null && UserInfo.getName() == 'Heroku Integration') {
            accp.MiddleName = oldMapperAcc.get(pacc.id).MiddleName;
          }
          if (oldMapperAcc.get(pacc.id).LastName != null && UserInfo.getName() == 'Heroku Integration') {
            accp.LastName = oldMapperAcc.get(pacc.id).LastName;
          }
          if (oldMapperAcc.get(pacc.id).PersonTitle != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.PersonTitle = oldMapperAcc.get(pacc.id).PersonTitle;
          }
          if (oldMapperAcc.get(pacc.id).deceased__c != false && UserInfo.getName() == 'Heroku Integration' ) {
            accp.deceased__c = oldMapperAcc.get(pacc.id).deceased__c;
          }
          if (oldMapperAcc.get(pacc.id).addressLine1__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.addressLine1__c = oldMapperAcc.get(pacc.id).addressLine1__c;
          }
          if (oldMapperAcc.get(pacc.id).addressLine2__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.addressLine2__c = oldMapperAcc.get(pacc.id).addressLine2__c;
          }
          if (oldMapperAcc.get(pacc.id).addressLine3__c != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.addressLine3__c = oldMapperAcc.get(pacc.id).addressLine3__c;
          }
          if (oldMapperAcc.get(pacc.id).addressLine4__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.addressLine4__c = oldMapperAcc.get(pacc.id).addressLine4__c;
          }
          if (oldMapperAcc.get(pacc.id).district__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.district__c = oldMapperAcc.get(pacc.id).district__c;
          }
          if (oldMapperAcc.get(pacc.id).city__c != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.city__c = oldMapperAcc.get(pacc.id).city__c;
          }
          if (oldMapperAcc.get(pacc.id).Region_Country__pc != null && UserInfo.getName() == 'Heroku Integration') {
            accp.Region_Country__pc = oldMapperAcc.get(pacc.id).Region_Country__pc;
          }
          if (oldMapperAcc.get(pacc.id).postalCodeNumber__c != null  && UserInfo.getName() == 'Heroku Integration'){
            accp.postalCodeNumber__c = oldMapperAcc.get(pacc.id).postalCodeNumber__c;
          }
          afteruppc.add(accp);
        }

        if ((pacc.countopp__pc == 0 || pacc.countopp__pc > 1) && pacc.Lead_Source_Most_Recent_Source__pc == 'CDB'  && UserInfo.getName() == 'Heroku Integration' ) {
          Opportunity opp1 = new Opportunity();
          opp1.Name = pacc.Name + 'Opp';
          opp1.AccountId = pacc.Id;
          opp1.CloseDate = system.today();
          opp1.StageName = 'Closed Won';
          opp1.CampaignId =  Label.Campaign_Id; 
          listofOppCreate.add(opp1);
        }
        else if (pacc.countopp__pc == 1 && pacc.Lead_Source_Most_Recent_Source__pc == 'CDB' && UserInfo.getName() == 'Heroku Integration' ) {
          Opportunity opp2 = [select id, Name, StageName from Opportunity where AccountId = :pacc.id];
          opp2.StageName = 'Closed Won';
          opp2.CampaignId = Label.Campaign_Id;   
          listofOpp.add(opp2);
        }

      }

    }

 if (listofOpp != null && !listofOpp.isEmpty()) {
      Update listofOpp;
    }

    if (listofOppCreate != null && !listofOppCreate.isEmpty()) {
      insert listofOppCreate;
    }
    if (afteruppc != null && !afteruppc.isEmpty()) {
      Update afteruppc;
    }

  }

}
 
  • March 09, 2021
  • Like
  • 0
I have created a trigger which creates an Individual, ConsentPointEmail and ConsentPointConsent records whenever email address is changed on a Person account. Have done the same thing for Phone number change. I wanted to check if I can convert that trigger to a helper class. Below is my trigger code: 

trigger consentAccountTrigger on Account (after update) {

string IndId;
string accPersonEmail;
string accPhone;    

List<Individual> IcList = new list<Individual>();
List<ContactPointEmail> cpeList = new list <ContactPointEmail> ();
List<Account> acc1List = new list <Account> ();   
List<ContactPointConsent> cpcList = new list <ContactPointConsent> ();
List<ContactPointPhone> cppList = new list <ContactPointPhone> ();
   
for (Account acc: Trigger.new) {
system.debug ('inforloop');
      if( trigger.oldMap.get(acc.Id).PersonEmail != acc.PersonEmail && acc.IsPersonAccount == TRUE && acc.PersonIndividualId == null){      
          system.debug ('checkIndividual');   
          Individual Ic = new Individual();
          Ic.LastName= acc.LastName;
          Ic.FirstName = acc.FirstName;  
          IcList.add(Ic);

}else if (acc.PersonIndividualId != null){
          IndId = acc.PersonIndividualId;                 
}

 }

    insert IcList;

for (Account acc1: Trigger.new) {
accPersonEmail = acc1.PersonEmail;
accPhone = acc1.Phone;    
if(IcList!=null && !IcList.isEmpty()){
for (Individual Ic1 : IcList){
    if(accountRecurssionHandler.avoidrecussion == TRUE){               
       accountRecurssionHandler.avoidrecussion = FALSE;
       Account acc2 = new Account ();
       acc2.id = acc1.Id;
       acc2.PersonIndividualId = Ic1.id;
       IndId = Ic1.id;
       acc1List.add(acc2);

}

if(trigger.oldMap.get(acc1.Id).PersonEmail != acc1.PersonEmail){
              
     ContactPointEmail cpe = new ContactPointEmail();
     cpe.IsPrimary = True;
     cpe.EmailAddress = accPersonEmail;
     cpe.ParentId = Ic1.Id;   
     cpeList.add(cpe);

 }             
 }

 }else{                                     
if(trigger.oldMap.get(acc1.Id).PersonEmail != acc1.PersonEmail){

 //if(acc.LastName == IcLastName){               
ContactPointEmail cpe = new ContactPointEmail();
cpe.IsPrimary = True;
cpe.EmailAddress = accPersonEmail;
cpe.ParentId = IndId;   
 cpeList.add(cpe);

 //}

}
}                                                             

    }

        update acc1List;                                      
        insert cpeList;   

    

        for (Account acc3: Trigger.new) {
        for (ContactPointEmail cpe1 : cpeList){  
            if(acc3.PersonEmail == cpe1.EmailAddress){
               ContactPointConsent cpc = new ContactPointConsent();
               cpc.Name = acc3.PersonEmail;
               cpc.ContactPointId = cpe1.Id;
               cpcList.add(cpc);                          
}
}         

        }

        //insert cpcList;

        
        for (Account acc: Trigger.new) {
          system.debug ('inforloop');
          if( trigger.oldMap.get(acc.Id).Phone != acc.Phone && acc.IsPersonAccount == TRUE && acc.PersonIndividualId == null){      
          system.debug ('checkIndividual');   
          Individual Ic = new Individual();
          Ic.LastName= acc.LastName;
          Ic.FirstName = acc.FirstName;  
          IcList.add(Ic);

}else if (acc.PersonIndividualId != null){
          IndId = acc.PersonIndividualId;                 
}

 }

    insert IcList;

for (Account acc1: Trigger.new) {
accPhone = acc1.Phone;    
if(IcList!=null && !IcList.isEmpty()){
for (Individual Ic1 : IcList){
    if(accountRecurssionHandler.avoidrecussion == TRUE){               
       accountRecurssionHandler.avoidrecussion = FALSE;
       Account acc2 = new Account ();
       acc2.id = acc1.Id;
       acc2.PersonIndividualId = Ic1.id;
       IndId = Ic1.id;
       acc1List.add(acc2);

}

if(trigger.oldMap.get(acc1.Id).Phone != acc1.Phone){
              
     ContactPointPhone cpp = new ContactPointPhone();
     cpp.IsPrimary = True;
     cpp.TelephoneNumber = accPhone;
     cpp.ParentId = Ic1.Id;   
     cppList.add(cpp);

 }             
 }

 }else{                                     
if(trigger.oldMap.get(acc1.Id).Phone != acc1.Phone){

 //if(acc.LastName == IcLastName){               
ContactPointPhone cpp = new ContactPointPhone();
cpp.IsPrimary = True;
cpp.TelephoneNumber = accPhone;
cpp.ParentId = IndId;   
 cppList.add(cpp);

 //}

}
}                                                             

    }

        update acc1List;                                      
        insert cppList;   

    

        for (Account acc3: Trigger.new) {
        for (ContactPointPhone cpp1 : cppList){  
            if(acc3.Phone == cpp1.TelephoneNumber){
               ContactPointConsent cpc = new ContactPointConsent();
               cpc.Name = acc3.Phone;
               cpc.ContactPointId = cpp1.Id;
               cpcList.add(cpc);                          
}
}         

        }

        insert cpcList;

}
  • November 27, 2020
  • Like
  • 0
I have created a Lightning component which replaces the standard Navigation buttons on the flow. On click of the Finish button it is suppose to close the tab. I have added this Lightning component on a flow and flow has been embedded in a Community. When I go to All Communities and click on the community URL the tab closes correctly. Which means the Lighning component is working correctly. However, when I open the community in a seperate tab the Lightning component does not work. It does not close the browser tab upon clicking on finish button. 

I did some troubleshooting and found that my windows.close () is not working and giving an error in Inspect>Element of the browser as "scripts may close only the windows that were opened by it". I checked few other functions and methods but none of them worked. Any help with this will be greatly appreciated. My Lightning component and Controller is mentioned below: 

Component:
<aura:component access="global" implements="lightning:availableForFlowScreens"  >
        
   <!-- Determine which actions are available -->
   <aura:attribute name="canPause" type="Boolean" />
   <aura:attribute name="canBack" type="Boolean" />
   <aura:attribute name="canNext" type="Boolean" />
   <aura:attribute name="canFinish" type="Boolean" />
   <aura:handler name="init" value="{!this}" action="{!c.init}" />
        
   <div aura:id="actionButtonBar" class="slds-clearfix slds-p-top_medium">
      <!-- If Previous is available, display to the left -->
      <div class="slds-float_left">
         <aura:if isTrue="{!v.canBack}">
            <lightning:button aura:id="BACK" label="Previous"
               variant="neutral" onclick="{!c.onButtonPressed}" />
         </aura:if>
      </div>
      <div class="slds-float_right">
         <!-- If Pause, Next, or Finish are available, display to the right -->
         <aura:if isTrue="{!v.canPause}">
            <lightning:button aura:id="PAUSE" label="Pause"
               variant="neutral" onclick="{!c.onButtonPressed}" />
         </aura:if>
         <aura:if isTrue="{!v.canNext}">
            <lightning:button aura:id="NEXT" label="Next" 
               variant="neutral" onclick="{!c.onButtonPressed}" />
         </aura:if>
         <aura:if isTrue="{!v.canFinish}">
            <lightning:button aura:id="FINISH" label="Finish"
               variant="brand" onclick="{!c.onButtonPressed}" />
         </aura:if>
      </div>
   </div>
</aura:component>


Controller: 
({
   init : function(cmp, event, helper) {
      // Figure out which buttons to display
      var availableActions = cmp.get('v.availableActions');
      for (var i = 0; i < availableActions.length; i++) {
         if (availableActions[i] == "PAUSE") {
            cmp.set("v.canPause", true);
         } else if (availableActions[i] == "BACK") {
            cmp.set("v.canBack", true);
         } else if (availableActions[i] == "NEXT") {
            cmp.set("v.canNext", true);
         } else if (availableActions[i] == "FINISH") {
            cmp.set("v.canFinish", true);
         }
      }
   },
        
   onButtonPressed: function(cmp, event, helper) {
      // Figure out which action was called
      var actionClicked = event.getSource().getLocalId();
      // Fire that action
      var navigate = cmp.get('v.navigateFlow');
      navigate(actionClicked);
      setTimeout(function(){ window.close() }, 1000);

   },
    
})
  • August 28, 2020
  • Like
  • 0
I have created a flow and added a logo image in the display text component of the flow. This flow is added on a community and using Embedded Services the community is embedded on an external Site. 

Issue is Guest users are not able to view the Logo image and it shows broken. I researched on the issue and found out that image added in a flow is saved as chatter file in Salesforce. Chatter file does not have any option to give access to Guest user. 

I also tried a workaround. I added the logo image as a Static resource and reference the static resource from the flow. It works fine when I run the flow but when I activate the flow and check on the external website the flow gives an error "Error element StaticResource (FlowRecordLookup).
This error occurred when the flow tried to look up records: sObject type 'StaticResource' is not supported.. You can look up ExceptionCode values in the SOAP API Developer Guide (https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper.salesforce.com%2Fdocs%2Fatlas.en-us.api.meta%2Fapi%2Fsforce_api_calls_concepts_core_data_objects.htm%23&data=02%7C01%7Cvikrant.panchmukhe%40volvocars.com%7Cc1c68ed287c44113df6308d81e512be8%7C81fa766ea34948678bf4ab35e250a08f%7C0%7C0%7C637292681261554579&sdata=A%2B76kq63UEnJbHrQUL%2B3E7%2BPDHN9c2P2k%2BaRxDgfoqI%3D&reserved=0" originalsrc="https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_concepts_core_data_objects.htm#" shash="M6huuBxsF0jyxjxWD7h9CUPEPZztP4y5zdEpJo6982dwWU7LBLlkzYzhrWJDYI8LUa+4xS87nkO0cOqaRhhc+eN4BvOdAizsuhwesu3HzCEmPI3/RUi005Erea3EiGFlTisFyQbtJtxh4KEipjy7Ftlo9n6JlBpBf1dHqtAZn9s=" style="color:blue; text-decoration:underline)." 
Any help will be greatly appreciated
  • July 02, 2020
  • Like
  • 0
Im new to lightning and I have created a lightning component and wanted to know how to display section of fields on button click. For example If I click the Length button then the fields, From Length, To Length, Enter a number and Calculate button should only display. Similarly, if I click Weight button then From Weight, To weight, Enter a number and Calculate button should display respectively.  

Component code:


<aura:component implements="flexipage:availableForAllPageTypes">
    
     <p> What would you like to convert today </p>

<br/>
    <lightning:button variant="brand" label="Volume" title="Volume" />
<lightning:button variant="brand" label="length" title="Length"/>
<lightning:button variant="brand" label="Weight" title="Weight"/>
<lightning:button variant="brand" label="Currency" title="Currency"/>
    
<br/>
<br/>
    
    <lightning:select name="selectFromVolume" label="From Volume" >
        <option value="">Select Unit</option>
        <option value="Litre">Litre</option>
        <option value="Millilitre">Millilitre</option>
    </lightning:select>
    
   
    <lightning:select name="selectToVolume" label="To Volume" >
        <option value="">Select Unit</option>
        <option value="Litre">Litre</option>
        <option value="Millilitre">Millilitre</option>
    </lightning:select>
    
    <aura:attribute name="myNumber" type="integer" default="10"/>
    <ui:inputNumber label="Enter a number: " value="{!v.myNumber}" updateOn="keyup"/> <br/>
    
   <lightning:button variant="brand-outline" label="Calculate" title="Calculate" />
    
    
<br/>
<br/>
    
    <lightning:select name="select1" label="From Length" >
        <option value="">Select Unit</option>
        <option value="Millimeter">Millimeter</option>
        <option value="CentiMeter">CentiMeter</option>
        <option value="Meter">Meter</option>
        <option value="Kilometer">Kilometer</option>
        <option value="Inch">Inch</option>
        <option value="Feet">Feet</option>
         <option value="Yard">Yard</option>
        <option value="Mile">Mile</option>
         <option value="Nautical Mile">Nautical Mile</option>
    </lightning:select>
    
     <lightning:select name="select1" label="To Length" >
        <option value="">Select Unit</option>
        <option value="Millimeter">Millimeter</option>
        <option value="CentiMeter">CentiMeter</option>
        <option value="Meter">Meter</option>
        <option value="Kilometer">Kilometer</option>
        <option value="Inch">Inch</option>
        <option value="Feet">Feet</option>
         <option value="Yard">Yard</option>
        <option value="Mile">Mile</option>
         <option value="Nautical Mile">Nautical Mile</option>
    </lightning:select>
    
    <aura:attribute name="myNumber1" type="integer" default="10"/>
    <ui:inputNumber label="Enter a number: " value="{!v.myNumber1}" updateOn="keyup"/> <br/>
   
    <lightning:button variant="brand-outline" label="Calculate" title="Calculate" />

<br/>
<br/>
    
    <lightning:select name="select1" label="From Weight" >
        <option value="">Select Unit</option>
        <option value="Pound">Pound</option>
        <option value="Kilogramm">Kilogramm</option>
        <option value="Pound">Pound</option>
        <option value="Gramm">Gramm</option>
        <option value="Milligram">Milligram</option>
    </lightning:select>
    
   <lightning:select name="select1" label="To Weight" >
        <option value="">Select Unit</option>
        <option value="Pound">Pound</option>
        <option value="Kilogramm">Kilogramm</option>
        <option value="Pound">Pound</option>
        <option value="Gramm">Gramm</option>
        <option value="Milligram">Milligram</option>
    </lightning:select>
    
    <aura:attribute name="myNumber2" type="integer" default="10"/>
    <ui:inputNumber label="Enter a number: " value="{!v.myNumber2}" updateOn="keyup"/> <br/>
    
    <lightning:button variant="brand-outline" label="Calculate" title="Calculate" />
      
    
<br/>
<br/>
    
</aura:component>



JS:

({
    myAction : function(component, event, helper) {
        

    }
})
  • April 20, 2020
  • Like
  • 0
Need help with bulk lead conversion issue. Lead records are pushed into Salesforce by Mulesoft through Heroku Integration. We have Apex logic in Salesforce which converts the lead to Person Account and Opportunity if the Lead type__c = 'Consumer'. Logic works fine with single records however when leads are pushed in bulk by Mulesoft into Salesforce some lead are converted and some are not. (Even if the  type__c = 'Consumer'). I have bulkified my code however still I see this behaviour. Doesnt work through Dataloader as well. 

Please check the code and suggest if there is a better way to handle bullk lead conversion. 
public class ConsumerRulesHelper {
public static boolean isfirsttime = true;

        public static void handleleadconv(list < Lead > ldlist, Map < Id, Lead > oldMap) {

            List < Opportunity > listofOpp = new list < Opportunity > ();
            List < Lead > afterupleads = new list < Lead > ();
            List <Account> listofaccs = new list <Account> ();
            List < Marketing_Sales_Interaction__c > msilist = new list < Marketing_Sales_Interaction__c > ();
            Set<Id> leadIds = new Set<Id>();
            List<Vehicle_Relationship__c> VRList = new list<Vehicle_Relationship__c> ();
                if (!ldlist.isEmpty() ) {
                    for (Lead Lds: ldlist) {
                        if (oldMap != null && !oldMap.isEmpty() && oldMap.containsKey(Lds.id)) {
                            Lead ld = new Lead();
                             ld.id = Lds.id;
                                if(Lds.type__c == 'Consumer'){
                                   ld.type__c = 'Consumer';
                                                                }
                             if (oldMap.get(Lds.id).consumerid__c != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.consumerid__c = oldMap.get(Lds.id).consumerid__c;
                              }
                          if (oldMap.get(Lds.id).consumerLanguage__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.consumerLanguage__c = oldMap.get(Lds.id).consumerLanguage__c;
                          }
                          if (oldMap.get(Lds.id).globalConsumerId__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.globalConsumerId__c = oldMap.get(Lds.id).globalConsumerId__c;
                          }
                          if (oldMap.get(Lds.id).market__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.market__c = oldMap.get(Lds.id).market__c;
                          }
                          if (oldMap.get(Lds.id).additionalName__c != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.additionalName__c = oldMap.get(Lds.id).additionalName__c;
                          }
                          if (oldMap.get(Lds.id).dateOfBirth__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.dateOfBirth__c = oldMap.get(Lds.id).dateOfBirth__c;
                          }
                          if (oldMap.get(Lds.id).employer__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.employer__c = oldMap.get(Lds.id).employer__c;
                          }
                            if (oldMap.get(Lds.id).FirstName != null && UserInfo.getName() == 'Heroku Integration' ) {
                                ld.FirstName = oldMap.get(Lds.id).FirstName;
                            }
                          if (oldMap.get(Lds.id).gender__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.gender__c = oldMap.get(Lds.id).gender__c;
                          }
                          if (oldMap.get(Lds.id).maritalStatus__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.maritalStatus__c = oldMap.get(Lds.id).maritalStatus__c;
                          }
                          if (oldMap.get(Lds.id).occupation__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.occupation__c = oldMap.get(Lds.id).occupation__c;
                          }
                          if (oldMap.get(Lds.id).MiddleName != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.MiddleName = oldMap.get(Lds.id).MiddleName;
                          }
                          if (oldMap.get(Lds.id).LastName != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.LastName = oldMap.get(Lds.id).LastName;
                          }
                          if (oldMap.get(Lds.id).Title != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.Title = oldMap.get(Lds.id).Title;
                          }
                          if (oldMap.get(Lds.id).deceased__c != false && UserInfo.getName() == 'Heroku Integration') {
                            ld.deceased__c = oldMap.get(Lds.id).deceased__c;
                          }
                          if (oldMap.get(Lds.id).active__c != false && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.active__c = oldMap.get(Lds.id).active__c;
                          }
                          if (oldMap.get(Lds.id).addressLine1__c != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.addressLine1__c = oldMap.get(Lds.id).addressLine1__c;
                          }
                          if (oldMap.get(Lds.id).addressLine2__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.addressLine2__c = oldMap.get(Lds.id).addressLine2__c;
                          }
                          if (oldMap.get(Lds.id).addressLine3__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.addressLine3__c = oldMap.get(Lds.id).addressLine3__c;
                          }
                          if (oldMap.get(Lds.id).addressLine4__c != null && UserInfo.getName() == 'Heroku Integration') {
                            ld.addressLine4__c = oldMap.get(Lds.id).addressLine4__c;
                          }
                          if (oldMap.get(Lds.id).district__c != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.district__c = oldMap.get(Lds.id).district__c;
                          }
                          if (oldMap.get(Lds.id).city__c != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.city__c = oldMap.get(Lds.id).city__c;
                          }
                          if (oldMap.get(Lds.id).country__c != null  && UserInfo.getName() == 'Heroku Integration') {
                            ld.country__c = oldMap.get(Lds.id).country__c;
                          }
                          if (oldMap.get(Lds.id).main__c != false && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.main__c = oldMap.get(Lds.id).main__c;
                          }
                          if (oldMap.get(Lds.id).postalCodeNumber__c != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.postalCodeNumber__c = oldMap.get(Lds.id).postalCodeNumber__c;
                          }
                          if (oldMap.get(Lds.id).primaryKey__c != null && UserInfo.getName() == 'Heroku Integration' ) {
                            ld.primaryKey__c = oldMap.get(Lds.id).primaryKey__c;
                          }
                              afterupleads.add(ld);
                            
          if (Lds.type__c != 'Consumer' && oldMap.get(Lds.id).Status == 'Inactive' && Lds.Lead_Source_Most_Recent_Source__c == 'CDB' ) {
                  Marketing_Sales_Interaction__c msi = new Marketing_Sales_Interaction__c(Lead__c = Lds.Id);
                  msilist.add(msi);
        }          
                    }
        if (Lds.type__c == 'Consumer' && !Lds.IsConverted) {       
          Database.LeadConvert lc = new database.LeadConvert();
          lc.setLeadId(Lds.id);
          lc.ConvertedStatus = 'Qualified';

          Database.LeadConvertResult lcr = Database.convertLead(lc);
          System.assert(lcr.isSuccess());
          System.Debug(lcr);
          system.debug('convertedleadID: ' +lcr.getLeadId());    
          Account accs = new Account(id = lcr.accountid, PersonBirthdate = Lds.dateOfBirth__c);
          listofaccs.add(accs); 
            
          //Set Opportunity to closed won.
          Opportunity opp = new Opportunity(id = lcr.opportunityid, StageName = 'Closed Won', CampaignId = Label.Campaign_Id);
          //update opp;
          listofOpp.add(opp);

          //Create Interaction Record
          Marketing_Sales_Interaction__c msi = new Marketing_Sales_Interaction__c(Account__c = lcr.AccountId);
          msilist.add(msi);

        }

    }
                for (Integer i = 0; i < ldlist.size(); i++){
                if (ldlist[i].IsConverted == true ){      
                for (Lead lead : ldlist){
                if(oldMap.get(lead.id).isConverted == false ){
                leadIds.add(lead.Id);
                }
            }
        }
}

Map<Id, Vehicle_Relationship__c> mapVR = new Map<Id, Vehicle_Relationship__c>([select Id, Primary_Driver__c,convertedcontactid__c, Lead__c from Vehicle_Relationship__c where lead__c in :leadIds]);      
        if(!ldlist.isEmpty()) {
            for (Lead lead : ldlist)  {
                for (Vehicle_Relationship__c vr : mapVR.values()) {
                    if (vr.Lead__c == lead.Id) {                      
                        vr.Primary_Driver__c = vr.convertedcontactid__c;
                       
                        VRList.add(vr);
                    }
                }
            }
        }
    }

    if (VRList != null && !VRList.isEmpty()) {
          Update VRList;
    }
    if(listofaccs!= null && !listofaccs.isEmpty()){
         update listofaccs;
     }        
    if (listofOpp != null && !listofOpp.isEmpty()) {
      Update listofOpp;
    }
    if (msilist != null && !msilist.isEmpty()) {
      insert msilist;
    }
    if (afterupleads != null && !afterupleads.isEmpty()) {
      Update afterupleads;
    }
  }
  
public static void handlepaccountupdation(list < Account > perAcclist, Map < Id, Account > oldMapperAcc) {

  List < Opportunity > listofOpp = new list < Opportunity > ();
  List < Opportunity > listofOppCreate = new list < Opportunity > ();
  List < Account > afteruppc = new list < Account > ();
  if (!perAcclist.isEmpty() ) {
      for (Account pacc: perAcclist) {
        if ( oldMapperAcc != null && !oldMapperAcc.isEmpty() && oldMapperAcc.containsKey(pacc.id)) {
          Account accp = new Account();
          accp.id = pacc.id;
          if (oldMapperAcc.get(pacc.id).consumerId__c != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.consumerId__c = oldMapperAcc.get(pacc.id).consumerId__c;
          }
          if (oldMapperAcc.get(pacc.id).consumerLanguage__c != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.consumerLanguage__c = oldMapperAcc.get(pacc.id).consumerLanguage__c;
          }
          if (oldMapperAcc.get(pacc.id).globalConsumerId__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.globalConsumerId__c = oldMapperAcc.get(pacc.id).globalConsumerId__c;
          }
          if (oldMapperAcc.get(pacc.id).MC_Business_Unit__c != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.MC_Business_Unit__c = oldMapperAcc.get(pacc.id).MC_Business_Unit__c;
          }
          if (oldMapperAcc.get(pacc.id).PersonBirthdate != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.PersonBirthdate = oldMapperAcc.get(pacc.id).PersonBirthdate;
          }
          if (oldMapperAcc.get(pacc.id).employer__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.employer__c = oldMapperAcc.get(pacc.id).employer__c;
          }
          if (oldMapperAcc.get(pacc.id).FirstName != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.FirstName = oldMapperAcc.get(pacc.id).FirstName;
          }
          if (oldMapperAcc.get(pacc.id).Gender__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.Gender__c = oldMapperAcc.get(pacc.id).Gender__c;
          }
          if (oldMapperAcc.get(pacc.id).maritalStatus__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.maritalStatus__c = oldMapperAcc.get(pacc.id).maritalStatus__c;
          }
          if (oldMapperAcc.get(pacc.id).occupation__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.occupation__c = oldMapperAcc.get(pacc.id).occupation__c;
          }
          if (oldMapperAcc.get(pacc.id).MiddleName != null && UserInfo.getName() == 'Heroku Integration') {
            accp.MiddleName = oldMapperAcc.get(pacc.id).MiddleName;
          }
          if (oldMapperAcc.get(pacc.id).LastName != null && UserInfo.getName() == 'Heroku Integration') {
            accp.LastName = oldMapperAcc.get(pacc.id).LastName;
          }
          if (oldMapperAcc.get(pacc.id).PersonTitle != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.PersonTitle = oldMapperAcc.get(pacc.id).PersonTitle;
          }
          if (oldMapperAcc.get(pacc.id).deceased__c != false && UserInfo.getName() == 'Heroku Integration' ) {
            accp.deceased__c = oldMapperAcc.get(pacc.id).deceased__c;
          }
          if (oldMapperAcc.get(pacc.id).addressLine1__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.addressLine1__c = oldMapperAcc.get(pacc.id).addressLine1__c;
          }
          if (oldMapperAcc.get(pacc.id).addressLine2__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.addressLine2__c = oldMapperAcc.get(pacc.id).addressLine2__c;
          }
          if (oldMapperAcc.get(pacc.id).addressLine3__c != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.addressLine3__c = oldMapperAcc.get(pacc.id).addressLine3__c;
          }
          if (oldMapperAcc.get(pacc.id).addressLine4__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.addressLine4__c = oldMapperAcc.get(pacc.id).addressLine4__c;
          }
          if (oldMapperAcc.get(pacc.id).district__c != null && UserInfo.getName() == 'Heroku Integration') {
            accp.district__c = oldMapperAcc.get(pacc.id).district__c;
          }
          if (oldMapperAcc.get(pacc.id).city__c != null && UserInfo.getName() == 'Heroku Integration' ) {
            accp.city__c = oldMapperAcc.get(pacc.id).city__c;
          }
          if (oldMapperAcc.get(pacc.id).Region_Country__pc != null && UserInfo.getName() == 'Heroku Integration') {
            accp.Region_Country__pc = oldMapperAcc.get(pacc.id).Region_Country__pc;
          }
          if (oldMapperAcc.get(pacc.id).postalCodeNumber__c != null  && UserInfo.getName() == 'Heroku Integration'){
            accp.postalCodeNumber__c = oldMapperAcc.get(pacc.id).postalCodeNumber__c;
          }
          afteruppc.add(accp);
        }

        if ((pacc.countopp__pc == 0 || pacc.countopp__pc > 1) && pacc.Lead_Source_Most_Recent_Source__pc == 'CDB'  && UserInfo.getName() == 'Heroku Integration' ) {
          Opportunity opp1 = new Opportunity();
          opp1.Name = pacc.Name + 'Opp';
          opp1.AccountId = pacc.Id;
          opp1.CloseDate = system.today();
          opp1.StageName = 'Closed Won';
          opp1.CampaignId =  Label.Campaign_Id; 
          listofOppCreate.add(opp1);
        }
        else if (pacc.countopp__pc == 1 && pacc.Lead_Source_Most_Recent_Source__pc == 'CDB' && UserInfo.getName() == 'Heroku Integration' ) {
          Opportunity opp2 = [select id, Name, StageName from Opportunity where AccountId = :pacc.id];
          opp2.StageName = 'Closed Won';
          opp2.CampaignId = Label.Campaign_Id;   
          listofOpp.add(opp2);
        }

      }

    }

 if (listofOpp != null && !listofOpp.isEmpty()) {
      Update listofOpp;
    }

    if (listofOppCreate != null && !listofOppCreate.isEmpty()) {
      insert listofOppCreate;
    }
    if (afteruppc != null && !afteruppc.isEmpty()) {
      Update afteruppc;
    }

  }

}
 
  • March 09, 2021
  • Like
  • 0
I have created a flow and added a logo image in the display text component of the flow. This flow is added on a community and using Embedded Services the community is embedded on an external Site. 

Issue is Guest users are not able to view the Logo image and it shows broken. I researched on the issue and found out that image added in a flow is saved as chatter file in Salesforce. Chatter file does not have any option to give access to Guest user. 

I also tried a workaround. I added the logo image as a Static resource and reference the static resource from the flow. It works fine when I run the flow but when I activate the flow and check on the external website the flow gives an error "Error element StaticResource (FlowRecordLookup).
This error occurred when the flow tried to look up records: sObject type 'StaticResource' is not supported.. You can look up ExceptionCode values in the SOAP API Developer Guide (https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper.salesforce.com%2Fdocs%2Fatlas.en-us.api.meta%2Fapi%2Fsforce_api_calls_concepts_core_data_objects.htm%23&data=02%7C01%7Cvikrant.panchmukhe%40volvocars.com%7Cc1c68ed287c44113df6308d81e512be8%7C81fa766ea34948678bf4ab35e250a08f%7C0%7C0%7C637292681261554579&sdata=A%2B76kq63UEnJbHrQUL%2B3E7%2BPDHN9c2P2k%2BaRxDgfoqI%3D&reserved=0" originalsrc="https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_concepts_core_data_objects.htm#" shash="M6huuBxsF0jyxjxWD7h9CUPEPZztP4y5zdEpJo6982dwWU7LBLlkzYzhrWJDYI8LUa+4xS87nkO0cOqaRhhc+eN4BvOdAizsuhwesu3HzCEmPI3/RUi005Erea3EiGFlTisFyQbtJtxh4KEipjy7Ftlo9n6JlBpBf1dHqtAZn9s=" style="color:blue; text-decoration:underline)." 
Any help will be greatly appreciated
  • July 02, 2020
  • Like
  • 0
Im new to lightning and I have created a lightning component and wanted to know how to display section of fields on button click. For example If I click the Length button then the fields, From Length, To Length, Enter a number and Calculate button should only display. Similarly, if I click Weight button then From Weight, To weight, Enter a number and Calculate button should display respectively.  

Component code:


<aura:component implements="flexipage:availableForAllPageTypes">
    
     <p> What would you like to convert today </p>

<br/>
    <lightning:button variant="brand" label="Volume" title="Volume" />
<lightning:button variant="brand" label="length" title="Length"/>
<lightning:button variant="brand" label="Weight" title="Weight"/>
<lightning:button variant="brand" label="Currency" title="Currency"/>
    
<br/>
<br/>
    
    <lightning:select name="selectFromVolume" label="From Volume" >
        <option value="">Select Unit</option>
        <option value="Litre">Litre</option>
        <option value="Millilitre">Millilitre</option>
    </lightning:select>
    
   
    <lightning:select name="selectToVolume" label="To Volume" >
        <option value="">Select Unit</option>
        <option value="Litre">Litre</option>
        <option value="Millilitre">Millilitre</option>
    </lightning:select>
    
    <aura:attribute name="myNumber" type="integer" default="10"/>
    <ui:inputNumber label="Enter a number: " value="{!v.myNumber}" updateOn="keyup"/> <br/>
    
   <lightning:button variant="brand-outline" label="Calculate" title="Calculate" />
    
    
<br/>
<br/>
    
    <lightning:select name="select1" label="From Length" >
        <option value="">Select Unit</option>
        <option value="Millimeter">Millimeter</option>
        <option value="CentiMeter">CentiMeter</option>
        <option value="Meter">Meter</option>
        <option value="Kilometer">Kilometer</option>
        <option value="Inch">Inch</option>
        <option value="Feet">Feet</option>
         <option value="Yard">Yard</option>
        <option value="Mile">Mile</option>
         <option value="Nautical Mile">Nautical Mile</option>
    </lightning:select>
    
     <lightning:select name="select1" label="To Length" >
        <option value="">Select Unit</option>
        <option value="Millimeter">Millimeter</option>
        <option value="CentiMeter">CentiMeter</option>
        <option value="Meter">Meter</option>
        <option value="Kilometer">Kilometer</option>
        <option value="Inch">Inch</option>
        <option value="Feet">Feet</option>
         <option value="Yard">Yard</option>
        <option value="Mile">Mile</option>
         <option value="Nautical Mile">Nautical Mile</option>
    </lightning:select>
    
    <aura:attribute name="myNumber1" type="integer" default="10"/>
    <ui:inputNumber label="Enter a number: " value="{!v.myNumber1}" updateOn="keyup"/> <br/>
   
    <lightning:button variant="brand-outline" label="Calculate" title="Calculate" />

<br/>
<br/>
    
    <lightning:select name="select1" label="From Weight" >
        <option value="">Select Unit</option>
        <option value="Pound">Pound</option>
        <option value="Kilogramm">Kilogramm</option>
        <option value="Pound">Pound</option>
        <option value="Gramm">Gramm</option>
        <option value="Milligram">Milligram</option>
    </lightning:select>
    
   <lightning:select name="select1" label="To Weight" >
        <option value="">Select Unit</option>
        <option value="Pound">Pound</option>
        <option value="Kilogramm">Kilogramm</option>
        <option value="Pound">Pound</option>
        <option value="Gramm">Gramm</option>
        <option value="Milligram">Milligram</option>
    </lightning:select>
    
    <aura:attribute name="myNumber2" type="integer" default="10"/>
    <ui:inputNumber label="Enter a number: " value="{!v.myNumber2}" updateOn="keyup"/> <br/>
    
    <lightning:button variant="brand-outline" label="Calculate" title="Calculate" />
      
    
<br/>
<br/>
    
</aura:component>



JS:

({
    myAction : function(component, event, helper) {
        

    }
})
  • April 20, 2020
  • Like
  • 0
Hi,

I trying to validate trailhead challenge " Quick Start: Heroku Connect Provision the Heroku Connect Add-on " but I have the error :
"Step Not yet complete... here's what's wrong:
The Heroku Connect Add on has not been setup correctly. "

I don't understand why, cause I've checked the listen and write option and selected the 7 fields in the mapping.
Moreover the contact is correctly updated in Salesforce.

I have tested with region Europe and also United States as mentionned here : https://developer.salesforce.com/forums/?id=906F00000005IX8IAM
but still the same error message.

Could you please advise ?

I want to automatically convert new leads into contacts. I have a trigger on Lead after update that will bulk convert 100 leads at a time. The problem I have  is that my marketing automation tool pushes new leads into Salesforce in batches of 200 at a time. When I try to import 200 leads, the bulk convert fails due to a too many DML 151 error.

 

I read that the convertlead function can only handle 100 records at a time. How can I edit the code to handle 200 imports at a time? Is it possible?

 

Thanks in advance.

 

trigger AutoConvert on Lead (after update) {

for(Lead myLead: Trigger.new){ if(Trigger.new[0].isConverted == false) { Database.LeadConvert lc = new database.LeadConvert(); lc.setLeadId(myLead.Id); lc.convertedStatus = 'Qualified'; //Database.ConvertLead(lc,true); lc.setDoNotCreateOpportunity(true); Database.LeadConvertResult lcr = Database.convertLead(lc); System.assert(lcr.isSuccess()); }}}