• sachinarorasf
  • NEWBIE
  • 390 Points
  • Member since 2018
  • Cloud Analogy


  • Chatter
    Feed
  • 14
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 127
    Replies
Hi all,

I need something like a clickable image. when I click the image in a page related record should be created.

Thanks in advance.
Hello, I am working on updating Salesforce records from an outside platform, and I need my:
1. SF Consumer Key
2. SF Consumer Secret
3. SF Token

How can I find what these are? 
Hi ,

I tried to create my first lightning application but i get the folowing error.

User-added image

Below is my code

Application
<aura:application extends="force:slds" >
    <c:TeacherAppCompo/>
</aura:application>

Component
<aura:component controller='TeacherCreateRecord' >

    <aura:attribute name="client" type="Teacher__c" default="{'sObjectType':'Teacher__c','Name' : '' }" />
    <ui:inputtext label="Enter Teacher Name"   value="{!v.client.Name}" />
    <ui:button label="Submit" press="{!c.createClient}"/>
</aura:component>

Client side contoller
({
    createClient : function(component, event) {
        
        
       //for logs
        console.log("In Client Controller");

        //getting the record info from component to js
        var varClient=component.get("v.client");
       
        //validation to  check of field is empty or not
        if($A.util.isEmpty(varClient.Name) || $A.util.isUndefined(varClient.Name) )
        {
           alert('First name is required');
            //return the value and function will stop
            return;
        }
         
         helper.createRecord(varClient);
    }
})

Helper
({
    createRecord : function() {
         
       
       console.log("In helper");
        
        //calling apex function
        alert('Before action');
        var action = component.get("c.createTeacherRecord");
         
        alert('Before set params function');
        //set the parameters
        action.setParams({
            client : varClient
        });
        
        alert('Before callback function');
        //set callback function
        action.setCallback(this,function(a){
            
            var response=a.getState();
            if(response == "SUCCESS")
            {
                //Reset form and this is optional
                var newrecord= {'sObjectType' : 'Teacher__c','Name':''};
                component.set("v.client",newrecord);
                alert('Record is Created');
            }else if(response == "ERROR")
            {
                alert('Record is not Created');
            }
        });
        //To enqueue all actions and let all happen one by one 
        $A.enqueueAction(action);
    }
    
})

ApexClass
public with sharing class TeacherCreateRecord {
    
    
    @AuraEnabled
    public static void createTeacherRecord(Teacher__c  client)
    {
        try{
            System.debug('Teacher Create Record class'+ client) ;
            if(client != null)
            {
                insert client;
            }
        }
    
       catch(Exception e) 
       {
            System.debug('Inside Apex class') ;   
       }
    }
 }

The object i have used is Teacher__c and i am trying to fetch the name which is a standard field .
Hi I am preparing for Saleforce Developer certification (PD-01) , I came acroos the below question.

A developer wants multiple test classes to use the same set of test data?

As per my kowledge , answer should be 'create set up method for each test class'

But in dump paper, it says,  "use seealldata==true annotaton in the test class"

i am not getting how it works, please explain.

Also please share dumps if u have
I am new to integrations, so this may be a very basic question. I need to create a mock up of JSON of a sample Salesforce record, to ultimately be able to post to an external API. My question is: is there any required context for constructing the JSON? E.g. do the field names need to equal the API names in salesfroce (e.g. {
  "Lead" : [ {
    "bed_count__c" : 55}]}

Or- can I assign the fields any name I want? Apologies if this is very basic, but your assitance is greatly helpful. 
I am working on Process Builder. My criteria is that if a multi-select-picklist field on the lookup object is not blank, I want to populate this field with that value. 

I am entering this value in my action step but it won't let me save:
What do I need to change? Thank you. 

[Discharge__c].Referral_Name__c.Language__c 
I need assistance in working on Trigger. I have a requirement, where I need to insert contact when Checkbox is clicked in account.

Eg: I have 3 checkboxes Electronics, Fashion, Furnitures. If I select 2 checkboxes Electronics and Fashion and save the Account. Then, I need to insert 2 contacts with field selected as Electronics and field selected as Fashion in another record.

I need assistance in this requirement.

Thanks.
Hi, i need to create event on lead for a test apex.
The EndDateTime (or activityDate) of this event need to be past.

I have create a lead and event on this lead but i can't choose a negative EndDateTime.
How can i do ?
It's possible to set a date time on Start Test for launch the test in the futur? Ty
Hi there, 

I'm quite stuck here. 
I've written a test class for my batch but it doesn't appears to be running. It stays at 0% :( 

I'm missing something but don't know what. 

Can someone help me figure it out? 

Here is my batch class : 
global class BatchUpdateAllLeads implements Database.Batchable <SObject> {
//START METHOD
    global Database.QueryLocator start(Database.BatchableContext bc){
        String Query='Select id,TECH_Update__c from Lead where TECH_Update__c=false AND Converted=false ' ;
        return Database.getQueryLocator(Query);
            }
//EXECUTE METHOD
    global void execute(Database.BatchableContext bc, List<Lead> scope){
        for(Lead l: scope){
            l.TECH_Update__c = true;
        }
        update scope;
    }
//FINISH METHOD
    global void finish(Database.BatchableContext bc){
        Id job= bc.getJobId();
        System.debug(job);
    }
}

And this is my attemp of writting a proper test class :( 
@istest
private class BatchUpdateAllLeads_TEST {
    @istest
    static void testAcc(){
        List<Lead> l = new List<Lead>();
        Lead l1 = new Lead(Company	='BTP',LastName = 'Test',SIRET__c='12659991955626',Numero_d_ordre__c='9999-99-99',Region_GRDF__c='Ile de France',Tech_Update__c=false,IsConverted=false);
        l.add(l1);

        Lead l2= new Lead(Company	='Comp',LastName = 'Test2',SIRET__c='12659991955687',Numero_d_ordre__c='1111-99-99',Region_GRDF__c='Ile de France',Tech_Update__c=false, IsConverted=true);
        l.add(l2);

        Lead l3= new Lead(Company	='Agny', LastName = 'Test3', SIRET__c='19959991988687', Numero_d_ordre__c='1111-99-11', Region_GRDF__c='Ile de France', Tech_Update__c=true,IsConverted=true);
        l.add(l3);
        insert l;
   
    Test.startTest();
    BatchUpdateAllLeads ap= new BatchUpdateAllLeads();
    Id jobid= Database.executeBatch(ap);
    Test.stopTest();
    }
}

Ty very much for your help
I have a Batch Class where it sends an email when Expiry Date (Custom Date Field) is today. The mail body contains the list of opportunities whose Expiry Date is Today. I have created a list and added the opportunities whose Expiry Date is today. But I am stuck at calling Opportunity Name from the List. Can someone help me to solve this.
//Batch Class

global class OpportunityExpiryDate_New implements DataBase.Batchable <sObject> {
    global DataBase.QueryLocator start(Database.BatchableContext BC) {
        String query = 'SELECT Name, Expiry_Date__c  FROM Opportunity WHERE Expiry_Date__c = TODAY';
        return Database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext BC, List<Opportunity> scope) {
        List<Opportunity> oppList = new List<Opportunity>();
        for(Opportunity opp : scope) {
            if(opp.Expiry_Date__c == date.today()) {
                oppList.add(opp);
            }
        }
        update oppList;
        messaging.SingleEmailMessage email = new messaging.SingleEmailMessage();
        String body = 'The Opportunity ' +oppList+ ' is expiring today.';
        email.setToAddresses(new String[]{'maddulasaivineeth@gmail.com'});
        email.setSubject('Opportunities Expiring Today');
        email.setPlainTextBody(body);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
    }
    global void finish(Database.BatchableContext BC) {   
    }
}
I am having a major brain block. I have the following Apex Trigger designed to keep a Probability % at a previously (manually) set level. This is that code:
trigger keepProbability on Opportunity (before update) {
    for(Integer i = 0; i < Trigger.new.size(); i++) {
        if(Trigger.old[i].stagename != Trigger.new[i].stagename) {
            if(Trigger.old[i].probability != Trigger.new[i].probability) {
               Trigger.new[i].probability = Trigger.old[i].probability;
            }
        }
    }

}

The trigger works great, but I am losing my mind trying to write a Test Class. Any tips on writing the test would be greatly appreciated.
 
Hello everyone!

My friends, maybe you can advise where I can practise new exercises on Apex Code (Classes, Triggers, Tests).

Do not offer Trailhead :)
Hi I am not able to save the record using lightning component.please find the code below.

Lightning Component:
<aura:component access="global" controller="LightningBloodDonorReg">
    
        <aura:attribute name="bloodReg" type="WT_BloodDonor__c" default="{ 'sobjectType' : 'WT_BloodDonor__c' }"/>
        
        <lightning:layout multipleRows="true">
            <div class="div1">
                <lightning:layoutItem flexibility="auto" padding="around-small" size="12">
                    JANASENA
                </lightning:layoutItem></div>
            <div class="div2">
                <lightning:layoutItem flexibility="auto" padding="around-small" size="12">
                    My Life; My janasena
                </lightning:layoutItem></div>
            
            <lightning:layoutItem flexibility="auto" padding="around-small" size="12">
                <lightning:layout >
                    <div style="padding-left:400px;">
                        <lightning:layoutItem size="4"></lightning:layoutItem>
                    </div>
                    <div style="background-color:orange;width:100%;">
                        <lightning:layoutItem flexibility="auto" padding="around-small" size="12" >
                            
                            <ui:inputText label="Donor Name" aura:id="Donor Name" class="field" value="{!v.bloodReg.Name}" />
                          Blood Group  <force:inputField  aura:id="Donor Name" class="field" value="{!v.bloodReg.BloodGroup__c}" />
                            <ui:inputText label="Donor Phone"  aura:id="Donor Name" class="field" value="{!v.bloodReg.PhoneNumber__c}" />
                           State <force:inputField  aura:id="Donor Name" class="field" value="{!v.bloodReg.State__c}" />
                           District <force:inputField  aura:id="Donor Name" class="field" value="{!v.bloodReg.District__c}" />
                            <!--   <ui:inputText label="Enter some text     " class="field" value="Test Field" updateOn="click"/>
                        <ui:inputText label="Enter some text     " class="field" value="Test Field" updateOn="click"/>
                        <ui:inputText label="Enter some text     " class="field" value="Test Field" updateOn="click"/>
                        <ui:inputText label="Enter some text     " class="field" value="Test Field" updateOn="click"/>-->
                            
                            <ui:button label="Submit" class="slds-button slds-button--neutral" labelClass="label" press="{!c.createDonor}"/>
                        </lightning:layoutItem>
                    </div>
                    
                    <lightning:layoutItem size="4"></lightning:layoutItem>
                </lightning:layout>
            </lightning:layoutItem>
        </lightning:layout>
  
</aura:component>


.JS file

({
  createDonor : function(component, event) {
    var newDonor = component.get("v.bloodReg");
    var action = component.get("c.createDonor");
    action.setParams({ 
        "bloodDonor": newDonor
    });
    action.setCallback(this, function(a) {
           var state = a.getState();
            if (state === "SUCCESS") {
                var name = a.getReturnValue();
                alert("success");
            }
        else{
              alert("Failed");
         }
        });
    $A.enqueueAction(action)
}
})

Class:

public class LightningBloodDonorReg {
    @AuraEnabled
    public static WT_BloodDonor__c bloodDonor { get; set; }
    
    public LightningBloodDonorReg() {
        
        bloodDonor = new WT_BloodDonor__c();
        
        
    }
    @AuraEnabled
    public static WT_BloodDonor__c saveDetails() {
        system.debug('bloodDonor'+bloodDonor);
       Upsert bloodDonor;
        system.debug('bloodDonor'+bloodDonor);
         return bloodDonor ;
    }
}
Hi All,

I was referring the salesforce documentation for lightning:input type="email" .There it is mentioned When multiple email is used, the email field expects a single email address or a comma-separated list of email addresses. Example, my@domain.com,your@domain.com with or without a space after the comma.Is it possible to use type="email" when there is a need to enter multiple email id.I have tried to enter multiple emails with comma separation but it is giving me error as "You have entered an invalid format.".
public List<Account> acclist = new List<Account>();
for(integer i =0; i<10; i++){
    Account acc = new Account();
    acc.name='Account'+i;
    acc.Industry = 'Agriculture';
    acclist.add(acc);
}
Database.SaveResult[] sr= database.insert(acc,false);
for(database.SaveResult srtest : sr){
    if(srtest.isSuccess()){
        system.debug('success');
    }
    else{
        for(database.error e : srtest.getErrors()){
            system.debug('**** '+e.getMessage());
        }
    }
}


I am getting -
variable doesnt exist : acc
error while executing this in anonymous window.
Hi all ,

i am getting a issus with the Registraion form when i am inserting the Records this is my Code
this is my calss
public class CustomerRegistrationClass {
        @auraEnabled
    public static string createAccount(Account acc){
        // exception handaling
        try{
            insert acc;
            return acc.Id;
        }catch(exception e){
            return 'Exception:'+e.getMessage();
        }
    }
}
this is my application :-
<aura:application extends="force:slds" controller="CustomerRegistrationClass">
    <aura:attribute name="accountRecord" type="Account" default="{
                                                                 'sobjectType':'Account',
                                                                      Industry:'Education'
                                                                 }"/>  <!--     its by defult industry-->
        <div class="slds-container--x-large slds-m-left_xx-large">
            <lightning:card title="Customer Registration Form" iconName="standard:account">
                <aura:set attribute="actions">
                    <lightning:button label="Save" onClick="{!c.saveData}"/>                
                    <lightning:button label="Cancel" onClick="{!c.cancelData}"/>
                        
                </aura:set>
                <div class="slds-m-left_x-large slds-m-right_x-large">
                    <lightning:input label="Name" value="{!v.accountRecord.Name}"/>
                    <lightning:input label="Phone" value="{!v.accountRecord.Phone}"/>
                    <lightning:input label="Industry" value="{!v.accountRecord.Industry}"/>
                </div>    
             </lightning:card>
    
    </div>
    
    
</aura:application>
this is my component :-
({
    saveData : function(component, event, helper) {
        var account = component.get("v.accountRecord"); //showing the defult valus
        alert('test message');
        console.log(account);
        
        var action = component.get("c.createAccount"); // action with Apex calss method so called c
        action.setParams({"acc":account});
        action.setCallback(this,function(response){
            var state = response.getState();
            console.log(state);
            if(state == "SUCCESS"){
                var result= response.getReturnValue();
                console.log(result);
                alert(result);
            }
        })
        $A.enqueueAction(action);
    },// one function completed on save data
    cancelData: function(component, event, helper){
        component.set("v.accountRecord",null);
    }
})

thanks
akhan

I am trying to create a Lightning Web Component that I can put on the standard Account page and have a custom toast message displayed every time the page is edited.   The LWC would not have any UI.  It would be hidden and respond to the record update event from the standard page.
I was able to do something similar with aura using this example: http://www.sfdcpanda.com/custom-user-message-in-standard-lightning-page/
But this example didn't work quite right.  It only seemed to fire when you edited the page through the edit button.  If you edited a field by clicking the pencil on the field it didn't fire the event.
So I am trying to do the equivalent with LWC in hopes that it will work correctly from either edit method.
Any help would be appreciated.

Hi, I get this error when updating few contact names in salesforce. " Error:Apex trigger CaseTrigger caused an unexpected exception, contact your administrator: CaseTrigger: execution of AfterUpdate caused by: System.NullPointerException: Argument cannot be null.: Class.CaseSharingController.shareCaseRecord: line 80, column 1"

Thankyou in advance!

Hello
I am having two strings separated by multiple commas. 
I need to retain only a single comma between the two strings.

for example I have as follows var cptCode = G1077,,,,,,,,,,D3456 

so after removing multiple commas, I will have like this :

var cptCode = G1077,D3456 

The user can enter 2 commas or 5 commas between the two strings.
Maximum number of commas between the two strings will be 10.


 I request the members to let me know how to achieve this.

Thanks
Meghna
Hi!

We are trying to identify the Terms of Use for using the Salesforce APIs (Rest and Bulk) via a "Connected App" (as described for "Access Data with API Integration" in this page: https://help.salesforce.com/articleView?id=connected_app_about.htm&type=5).

What we want to understand is what terms of use the APIs themselves have as well as when one uses such a "Connected App" configuration. And also if it matters, from a Terms of Use perspective, if the "Connected App" configuration is created in a "Developer Edition" account or in a "full" Salesforce Account.

Does anyone know?
I am completely new to Triggers.
My scenario is:
If "Call Completed" checkbox in Opportunity field is checked then "Stage" field in Opportunity Object must change to "Quotation".

Could anyone tell me how to acheive this?
I'm completely blank..
I would be glad if you suggest me how to master Triggers in Salesforce too.


Thanks in Advance !
 
My test class covers only 76% of the trigger that creates Opportunity to the newly inserted Account. 
Here is my trigger and test class. Please help me to cover 100%.
trigger AddRelatedRecord on Account (after insert, after update) {
    if (Trigger.isInsert) {
        for (Account a : Trigger.new) {
            Opportunity opp = new Opportunity();
            opp.Name = a.Name + ' Opportunity';
            opp.StageName = 'Prospecting';
            opp.CloseDate = System.today().addMonths(1);
            opp.AccountId = a.Id;
            insert opp;

        }
    }

    if (Trigger.isUpdate) {
        List<Opportunity> oppList = new List<Opportunity>();

        List<Account> accountsWithoutOppsAndGotUpdated = [
                SELECT Id, Name
                FROM Account
                WHERE Id NOT IN (SELECT AccountId FROM Opportunity) AND Id IN :Trigger.new
        ];

        for (Account a : accountsWithoutOppsAndGotUpdated) {
            oppList.add(new Opportunity(Name = a.Name + ' Opportunity',
                    StageName = 'Prospecting',
                    CloseDate = System.today().addMonths(1),
                    AccountId = a.Id));
        }
        update oppList;
    }
}
 
@IsTest
private class AddRelatedRecordTest {

    @IsTest public static void addRelatedRecordTestonInsert() {

        Account testAcc = new Account();
        testAcc.Name = 'My Account Test';
        insert testAcc;
        update testAcc;

        System.assert(true, 'Opp Created');

    }

}

 
Hi all,

I need something like a clickable image. when I click the image in a page related record should be created.

Thanks in advance.
Hi, I am still in the early days of my apex journey so trying to get my head around basic concepts.

I have built a simple enough trigger which does the following. When somebody is creating or update a lead it looks at the values in 6 key fields and then counts the number that are not null. It then enters that value in the 'Key fields' field on the lead record.

Secondly if this value is greater than or equal to three it creates a task for each of the completed key fields.

So far I have gotten the first stage of the process to work by using before insert and before update. However now since the task record will require a lead ID I suspect I will need to use 'after update/insert' capabilities.

What would you suggest is the best way to modify my code to account for these two requirments.
 
trigger KeyFieldsPopulated on Lead (before insert, before update) {
     
    for (Lead l : Trigger.New) {
        //Create list to store key fields 
        List<String> KeyFields = new List<String>();
        KeyFields.add(l.FirstName);
        KeyFields.add(l.LastName);
        KeyFields.add(l.Email);
        KeyFields.add(l.Phone);
        KeyFields.add(l.Website);
        KeyFields.add(l.Title);
        
        
        //Create list to store key fields that have a value
        List<String> KeyFieldsPopulated = new List<String>();
        
        //Create a counter variable to track how many key fields have a value
        Integer counter = 0;
        
        //Loop through the key fields 
        for (Integer i = 0; i<KeyFields.size(); i++) {
            if (KeyFields[i]!=null) {
                KeyFieldsPopulated.add(KeyFields[i]);
                counter = counter + 1;
                
            }
            l.Key_Fields__c = counter;
        }
        
            //Loop through the populated key fields and create a task
            if (counter >= 3) {
                for (Integer j = 0; j < KeyFieldsPopulated.size(); j++) {
                    Task t = new Task();
                    t.Subject = 'Verify the '+ KeyFieldsPopulated[j] + ' field';
                    t.WhatId = l.Id;
                }
             
          }
       
    }

}

 
Apex class:-
  @AuraEnabled
    public static List < sObject > fetchLookUpValues(String searchKeyWord, String ObjectName, List<sObject> ExcludeitemsList, String UserId) 
    {
        try{
            
            List <Group > Careagentgroup;
            List <Group > noncareagentgroup;
            String searchKey = '' + searchKeyWord + '%';
            List <String> lstOfGroupIds = new List <String> ();
            List <Group> lstOfQueue;
            List <GroupMember> lstOfSubGroupId;
            Set<id> idGroup = new Set<id>();
            lstOfSubGroupId =  [SELECT GroupId from GroupMember WHERE UserOrGroupId=: UserId LIMIT 500];
            if(lstOfSubGroupId.size()>0){
            for(GroupMember gm : lstOfSubGroupId){
                idGroup.add(gm.GroupId); 
            }
            }
            lstOfQueue =  [SELECT Id from Group WHERE Id IN (Select Groupid from GroupMember where userOrGroupId in : idGroup) LIMIT 500];
            if(lstOfQueue.size()>0){
            for(Group q : lstOfQueue){
                lstOfGroupIds.add(q.Id);
            }
            }
            
            List<string> lstExcludeitems = new List<string>();
            for(sObject item : ExcludeitemsList ){
                lstExcludeitems.add(item.id);
            }
            Careagentgroup=[select name from group where name like'care%' AND Name LIKE: searchKey AND Id NOT IN : lstExcludeitems AND Id NOT IN : lstOfGroupIds];
            noncareagentgroup=[select name from group where Name LIKE: searchKey AND (NOT name LIKE 'care%') AND Id NOT IN : lstExcludeitems AND Id NOT IN : lstOfGroupIds];
            list<user> u=[select id,name,profile.name from user where id=:UserId];
            List <sObject> returnList = new List <sObject> ();    

                if(u[0].profile.name=='Service Care Agent'){
                    for (sObject obj: Careagentgroup) {
                                returnList.add(obj);
                            }
                }
                else{
                    for (sObject obj: noncareagentgroup) {
                                returnList.add(obj);
                            }                    
                    }
                return returnList;    
        }
        catch(Exception e){
                
            System.debug('The following exception has occurred: ' + e.getMessage());
            return null;
        }
    }

helper :-

({
     searchHelper : function(component,event,getInputkeyWord,UserId) {
        var action = component.get("c.fetchLookUpValues");
        action.setParams({
            'searchKeyWord': getInputkeyWord,
            'ObjectName' : component.get("v.objectAPIName"),
            'ExcludeitemsList' : component.get("v.lstSelectedRecords"),
            'UserId' : UserId
        });
        
        //String searchKeyWord, String ObjectName, List<sObject> ExcludeitemsList, List<Group> lstofgrp
        action.setCallback(this, function(response) {
            $A.util.removeClass(component.find("mySpinner"), "slds-show");
            var state = response.getState();
            console.log("state" + state);
            if (state === "SUCCESS") {
                var storeResponse = response.getReturnValue();
                  //console.log("storeResponse-----" +storeResponse[0].Name );
                if (storeResponse.length == 0) {
                    component.set("v.Message", 'No records found');
                } 
           
                else {
                    component.set("v.Message", '');
                }
                component.set("v.listOfSearchRecords", storeResponse); 

            }
            
        });
        $A.enqueueAction(action);
    },
})

Question is :- I want to take the values present in the "returnlist" from apex class and compare it in the helper and based on the comparision will print the message as " not authorized".
How to get All Objects and Their Field? Please help me thank before<.^.>
Hi Folks,
I have the below requirment:
Contact: First Name, Last Name, EmailIf we create same values in the above mentioned field, then give alert message on saving the record. It should say same type of record already exist and still should save the record.
 
Hello, I have a simple trigger to send an email after deletion of a Quote line item record. It takes some information from the parent Quote like:
Status and Name.
 
trigger QuoteLineItemEmailBeforeDelete on QuoteLineItem (after delete) {
    Set<Id> quids = new Set<Id>();
    for(QuoteLineItem qli :Trigger.Old) {
        quids.add(qli.QuoteId);
    }
    Quote[] quo = [Select Id, Name, Status, RecordTypeId from Quote Where id In :quids];
    if((quo[0].Status == '2. Validated - Waiting for order' || quo[0].Status == '3. Offer partially entered in SAP' || quo[0].Status == '4. Offer fully entered in SAP')&& (Quo[0].Name.Contains('H3'))) {
  Messaging.reserveSingleEmailCapacity(trigger.size);
    List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();
    for (QuoteLineItem qli : Trigger.old) {
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
        email.setToAddresses(new String[] {'becommingaprogrammer@example.com'});
        email.setSubject('Oznámení o změně nabídky');
        email.setPlainTextBody('Došlo ke změně nabídky ' + Quo[0].Name + '.\n\n' + 'Pro otevření záznamu v Salesforce klikněte na následující odkaz:\n\n' +  'https://sg--testing.lightning.force.com/lightning/r/Quote/' + quo[0].Id + '/view');
        emails.add(email);
    }
    Messaging.sendEmail(emails);
        
    }
}

The thing is I don't know how to bulkify the code. What if someone mass deletes let's say 100 records? What if those records will each have a different Quote?

How do I then pair the deleted record with the parent quote to evalute if the email should be sent based on Status or Name?
Is there a way to combine both these classes(Account & Case)  into one so i there isn't two seperate classes in my org? I'm not sure how to accimplish this and could use help.

Account class
Public Class VF_SiteServicePartnerAllController{
   private Account acc;
   public List<Site_Service_Partner__c> sspList {get;set;}
   
   public VF_SiteServicePartnerAllController(ApexPages.StandardController sp){
       acc = (Account)sp.getRecord();
       sspList = new List<Site_Service_Partner__c>();
       sspList = [SELECT Id,Name,Site_Account__c,Primary_Field_Contact__c,Service_Partner__c,
                  Service_Partner_Owner__c,Service_Partner_Owner_Mobile__c,Service_Partner_Owner_Email__c,
                  Primary_Field_Email__c,Primary_Field_Mobile__c,Service_Partner_Site_Status__c, 
                  Contracted_Services__c,Secondary_Field_Contact__c,Secondary_Field_Email__c,Secondary_Field_Mobile__c,
                  Service_Partner_Start_Date__c,Service_Partner_End_Date__c,Service_Partner_Main_Phone__c,Trade__c,Supported_Trade__c,trade_value__c  FROM Site_Service_Partner__c WHERE Site_Account__c =: acc.Id    AND  Trade__c IN ('Land', 'Snow', 'Land;Snow') AND Service_Partner_Site_Status__c = 'Active'];

    
    Set<Id> bidId = new  Set<Id>();  
    for(Site_Service_Partner__c bs:sspList){
       bidId.add(bs.Id);
    }
     
   }

}

Case class
//Used on the Case object updated 1-31-2020
Public Class VF_CaseServicePartExtController{
private Case css;
   public List<Site_Service_Partner__c> cseList {get;set;}
   
   public VF_CaseServicePartExtController(ApexPages.StandardController sp){
       css= (Case)sp.getRecord();
       cseList = new List<Site_Service_Partner__c>();
       cseList = [SELECT Id,Name,Case__c,Site_Account__c,Primary_Field_Contact__c,Service_Partner__c,
                  Primary_Field_Email__c,Primary_Field_Mobile__c,Service_Partner_Site_Status__c, Contracted_Services__c,
                  Secondary_Field_Contact__c,Secondary_Field_Email__c,Secondary_Field_Mobile__c,Service_Partner_Owner__c,
                  Trade__c,Supported_Trade__c  FROM Site_Service_Partner__c WHERE Case__c =: css.Id AND Trade__c includes('Land','Snow','Land;Snow') AND Service_Partner_Site_Status__c='Active' ];
    
    Set<Id> bidId = new  Set<Id>();  
    for(Site_Service_Partner__c bs:cseList){
       bidId.add(bs.Id);
    }
     
   }
 

}


 
  • February 20, 2020
  • Like
  • 0
Hi,
I know that apex batch query locator is capabile of 50 million rows but what is the limit on a query that I peform while inside my batch apex.  Lets say I have to query a table that has over 10K rows and I need to review that data per batch iteration?  Is the limit 50k or what?

Thanks for your support.
It's a basic question. How to rename Lightning component once created?  I couldn't find any menu on Devloper console and any buttons on Setup|Develop|Lightning Components. Is it necessary to delete and create new one with new name?