function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sahil YadavSahil Yadav 

How could we send the static resource link through an email not the exact document???

Hello Developers and Community Leaders, 
                                  I have got a scenario but not getting any path how may i could proceed on this and suggestion or thought would be apprechiable.
trigger ddi_Account_Trigger on Account (before insert) {
    switch on Trigger.operationType {
        when  Before_Insert{
             //List<Account> accountList =[SELECT Id, Name, MultiSelect_State__c,Account_Email__c, createddate FROM Account Order By createddate Desc Limit 1];
            ddiAccountTriggerHandler.getDDIAccount( trigger.new );
        }
    }
}



===========================================================================


public class ddiAccountTriggerHandler {
    
    public static void getDDIAccount(List<Account> accountList){
        //List<Account> accountList =[SELECT Id, Name, MultiSelect_State__c,Account_Email__c, createddate FROM Account Order By createddate Desc Limit 1];
        if (accountList != Null && accountList.size()>0){
            System.debug('@@@' +accountList);
            for(Account ac : accountList){
                System.debug('@@@'+ac.MultiSelect_State__c);
                List<String> States = ac.MultiSelect_State__c.split(';');
                System.debug('@@@' +States);
                System.debug('@@@'+States.size());
                for(integer i = 0; i < states.size(); i++){
                    String state = states[i];
                    String email = ac.Account_Email__c;
                    //Url u = https://iaaicsr--parvathy.my.salesforce.com/sfc/p/2i0000000rP7/a/2i0000009JVE/vIRIVQqXM1Ib31jKcU6kFD1qWryC2jPP7yNTfYwErYs;
                    
                    switch on state{
                        when 'Maharashtra'{
                           // Blob b = https://iaaicsr--sahil.my.salesforce.com/one/one.app#/alohaRedirect/08123000000BN09?isdtp=p1;
                           
                            System.debug('@@@Hurray Maharashtra' );
                            ddiAccountEmailSend.sendEmail(state, email);
                            
                        }
                        when 'Gujarat'{
                            System.debug('@@@Hurray Gujarat');
                            ddiAccountEmailSend.sendEmail(state, email);
                            
                        }
                        when 'Tamil Nadu'{
                            System.debug('@@@Hurray Tamil Nadu');
                            ddiAccountEmailSend.sendEmail(state, email);
                            
                        }
                        when 'Himachal'{
                            System.debug('@@@Hurray Himachal');
                            ddiAccountEmailSend.sendEmail(state, email);
                            
                        }
                        
                    }
                    
                }
                
                
            }
            
        }
        
    }
}


=================================================================


public class ddiAccountEmailSend {
    public static void sendEmail(String state, String email, String u){
        // creating an instance of SingleEmailMessage
        Messaging.SingleEmailMessage objEmail = new Messaging.SingleEmailMessage();
        
        // Setting the body for the email
        objEmail.setPlainTextBody('This is a Plain Text');
        
        // Setting the Subject for the email
        objEmail.setSubject('Interested States Related Pdf');
        //
        // Setting up the Address to whom we needed to send an Email
        objEmail.setToAddresses(new String[] {email});
        
        Messaging.EmailFileAttachment[] attachments  = new Messaging.EmailFileAttachment[1];
        
        Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();
        
        //Getting an Attachments from the Static Resource
        List<StaticResource> objPDF = [Select body, name from StaticResource where Name =: state];
        
        // setting the body of an attachment
        attachment.setBody(objPDF[0].body); 
        
        // setting up the file name of an attachment
        attachment.setFileName(objPDF[0].name +'.pdf');
        
        //Assinging the single attachment to a list  
        attachments[0] = attachment;
        
        objEmail.setFileAttachments( attachments);
        
        
        // Finally Send the Email
        
        List<Messaging.Sendemailresult> objER = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {objEmail});
        
        if (!objER[0].isSuccess()){
            // Error handling;
        }
        
        
        
        
    }
    
    
}

So this code basically sending the sending the email in which some respective pdf is been get attached depending on the state multiselect picklist value selected while creating an account .. 
Any suggestion on how could we place the url for thr document and that url only must be sent to that account email
 
Doolk star220Doolk star220
McDonald’s is an American fast-food company, and it is the world’s largest restaurant chain by revenue. McDonald’s Menu includes more than 200 items for its consumers.
Also Read: McDonald’s Breakfast Menu (https://mcdonalds-breakfast-menu.info/)
Here we have listed all the menu items served worldwide in McDonald’s Menu with prices and McDonald’s Breakfast Menu with prices and also included McDonald’s breakfast hours, Business hours, Holiday Hours, etc.
McDonald’s is the biggest name in the worldwide fast-food industry, and they serve an amazing 68 million consumers each day.
McDonald’s company has grown substantially over the years; from a simplified menu of potato chips, hamburgers and orange juice, they now serve a range of salads, burgers, wraps, breakfast items and desserts.
McDonald’s gives some of the most sought out breakfast menu items served in fast food. They have a fabulous range of more than affordable menu items, making them the ideal early morning treat.