• Bob Lee 14
  • NEWBIE
  • 70 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 1
    Replies
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
I am littile bit confuse about <lightnign:input /> & <ui:input /> when to use which and what differences does it makes?
public class Search_For_User {
String keyword;
List<user>results = new List<user>();
public String getkeyword(){
return keyword;
}
public List<user> getresults(){
return results;
}
public void setkeyword(String input){
keyword = input;
}
public PageReference searchUser(){
results = (List<User>)[FIND :keyword IN NAME FIELDS RETURNING USER(FirstName, LastName, ProfileId)][0];
return null;
}
System.debug(results);
}
Can someone help me please...
public class CustomEmailComponentHandler {
    @AuraEnabled
    public static User getUserInfo() {
        try{
            User UserObj = [SELECT Name,Email 
                            FROM User 
                            WHERE Id = :UserInfo.getUserId()];
            return UserObj;
            
        }catch(Exception e){
            System.debug('Exception ::' + e.getMessage() + '==============Line Number ::' + e.getLineNumber());
        }
        return null;
    }
    
    @AuraEnabled
    public static  List<SearchResultWrapper> getSearchResult(String searchKeyword){
        try{
            String searchkey = '%'+ searchKeyword + '%';
            System.debug('searchkey ::'+searchkey);
            List<Lead> leadList = new List<Lead>();
            List<Contact> contactList = new List<Contact>();
            List<SearchResultWrapper> searchResultWrapperList = new List<SearchResultWrapper>();
            leadList = [SELECT Name,Email FROM Lead WHERE Email != Null AND Name != Null AND (Name Like :searchkey OR Email Like :searchkey) LIMIT 50000];
            System.debug('leadList ::'+leadList);
            contactList =[SELECT Name,Email FROM Contact WHERE Email != Null AND Name != Null AND (Name Like :searchkey OR Email Like :searchkey )LIMIT 4];
            System.debug('contactList ::'+contactList);
            if(leadList.size()>0 || contactList.size()>0){
                for(Lead Obj : leadList){
                    SearchResultWrapper searchResultWrapperObj = new SearchResultWrapper();
                    searchResultWrapperObj.Name = Obj.Name;
                    searchResultWrapperObj.Email = Obj.Email;
                    searchResultWrapperObj.ObjectName = 'Lead';
                    searchResultWrapperList.add(searchResultWrapperObj);
                }
                for(Contact Obj : contactList){
                    SearchResultWrapper searchResultWrapperObj = new SearchResultWrapper();
                    searchResultWrapperObj.Name = Obj.Name;
                    searchResultWrapperObj.Email = Obj.Email;
                    searchResultWrapperObj.ObjectName = 'Contact';
                    searchResultWrapperList.add(searchResultWrapperObj);
                }
                System.debug('searchResultWrapperList'+searchResultWrapperList);
            }
            return searchResultWrapperList;
            
            
        }catch(Exception e){
            System.debug('Exception ::' + e.getMessage() + '-----Line Number::' + e.getLineNumber());
        }
        return null;
    }
    
    @AuraEnabled
    public static String senMail_apex(String sendFrom, List<String> To, List<String> Cc, List<String> Bcc, String Subject, String Body, List<String> Attachments){
        try{
            List<ContentVersion> contentVersionList = new List<ContentVersion>();
            List<Messaging.EmailFileAttachment> attachmentList = new List<Messaging.EmailFileAttachment>();
            System.debug('sendFrom :' + sendFrom);
            Set<Id> documentId = new Set<Id>();
            if(Attachments.size()>0){
                for(String obj :Attachments){
                    documentId.add(obj);
                }  
            }
            if(documentId.size()>0){
                contentVersionList = [SELECT VersionData,Title,FileExtension FROM ContentVersion WHERE ContentDocumentId In :documentId AND IsLatest = true] ; 
            }
            if(contentVersionList.size()>0){
                for(ContentVersion fileobj : contentVersionList){
                    Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment();
                    attach.filename = fileobj.Title + '.' + fileobj.FileExtension;
                    attach.body = fileobj.VersionData;
                    attachmentList.add(attach);
                }
            }
            
            
            
            Messaging.SingleEmailMessage sendMail = new Messaging.SingleEmailMessage();
            
            sendMail.setSenderDisplayName(sendFrom);
            sendMail.setToAddresses(To); 
            sendMail.setBccAddresses(Bcc); 
            sendMail.setCcAddresses(Cc); 
            sendMail.setSubject(Subject); 
            sendMail.setHtmlBody(Body);
            sendMail.setFileAttachments(attachmentList);
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] {sendMail}) ; 
            
            return null;
        }catch(Exception e){
            System.debug('Exception ::' + e.getMessage() + '-----Line Number::' + e.getLineNumber());
        }
        return null;
        
    }
    
    @AuraEnabled
    public static  List<ContentDocument> getFiles(){
        try{
            List<ContentDocument>  contentDocumentList = [SELECT id,ContentSize,ContentModifiedDate,FileExtension,Title,FileType 
                                                          FROM ContentDocument
                                                          LIMIT 50000];
            return contentDocumentList;
            
        }catch(Exception e){
            System.debug('Exception ::' + e.getMessage() + '-----Line Number::' + e.getLineNumber());
        }
        return null;
        
    }
    
    @AuraEnabled
    public static  List<ContentDocument> searchFiles( String searchKeyword){
        try{
            String searchkey = '%'+ searchKeyword + '%';
            List<ContentDocument>  contentDocumentList = [SELECT id,ContentSize,ContentModifiedDate,FileExtension,Title,FileType 
                                                          FROM ContentDocument WHERE
                                                          Title LIKE :searchkey
                                                          LIMIT 50000];
            return contentDocumentList;
            
        }catch(Exception e){
            System.debug('Exception ::' + e.getMessage() + '-----Line Number::' + e.getLineNumber());
        }
        return null;
        
    }
    
    
    public class SearchResultWrapper {
        @AuraEnabled
        public String Name {get;set;}
        @AuraEnabled
        public String Email {get;set;}
        @AuraEnabled
        public String ObjectName {get;set;}
    }
}

Can anybody help me what are the Standard sales cloud objects..? can anybody list of those standard salescloud objects..?