• Sudhir Dudeja
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies

Hello Everyone,

I have just created some action and I added that action in business account but i couldn't able to add that action for the person account, so my question is how can i add that action into the person account layout.

Thanks

 

public with sharing class MassUpdateInstructor {
           public SFDC_Class__c sess{get;set;}
           public Set<Id> sessIDS;
           public String selectedSessID;
           public List<SFDC_Class__c> sfdcRecords;
           public boolean pgb{get;set;}
	public MassUpdateInstructor() {
    	  sess=new SFDC_Class__c();
            sessIDS= new Set<Id>();
            sfdcRecords=new List<SFDC_Class__c>();
            selectedSessID = ApexPages.CurrentPage().getParameters().get('id');
            pgb=true;
            //System.debug('value is'+pgb);
            system.debug(selectedSessID);
            processIDS(selectedSessID);
	}

            public void processIDS(String sessionIDS){

                if(sessionIDS != null && sessionIDS !='')
                     {
                         List<String> strList = sessionIDS.split(',');
                         for (String s: strList)
                         {
                             sessIDS.add(s);
                         }
                        system.debug(sessIDS);
                     }
            }

            public PageReference fetchRecord(){

                //System.debug('value is'+pgb);
                sfdcRecords=[Select Contact__c from SFDC_Class__c where id=:sessIDS];
                System.debug(sfdcRecords);
                for(SFDC_Class__c sfdc:sfdcRecords){
                    sfdc.Contact__c=sess.Contact__c;
                }
                try {
                    update sfdcRecords;
                    pgb=false;
                    ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO, 'Sessions Instructor are Updated');
                    ApexPages.addMessage(myMsg);
                    //System.debug('value is'+pgb);
                } catch(Exception e) {
                    ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Error, 'There is an error: '+' '+e.getMessage());
                    ApexPages.addMessage(myMsg);
                    System.debug(e.getMessage());
                }
                return null;
            }
}


The above code is for my massupdate button and this button is in the list view now whenever i tried to update multiple records , a trigger in update event get fired and that trigger have simple query to update event but it give me such strange error , see below trigger query.
 
eventList=[Select StartDateTime FROM Event limit 2];
          system.debug(eventList);
          update eventList;


The error is given below, Please help to sort out this problem 

Note: When i try to update a single record(using limit 1) I would not get any error but for multiple records i am getting an error


Update failed. First exception on row 0 with id a08c00000080wefAAA; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CreateEvents: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 00Uc0000003cwSPEAY; first error: INVALID_ID_FIELD, invalid record id: [] Class.MassUpdateInstructor.callTrigger: line 55, column 1 Trigger.CreateEvents: line 238, column 1: []

Hello Everyone,

I have just created some action and I added that action in business account but i couldn't able to add that action for the person account, so my question is how can i add that action into the person account layout.

Thanks

 

public with sharing class MassUpdateInstructor {
           public SFDC_Class__c sess{get;set;}
           public Set<Id> sessIDS;
           public String selectedSessID;
           public List<SFDC_Class__c> sfdcRecords;
           public boolean pgb{get;set;}
	public MassUpdateInstructor() {
    	  sess=new SFDC_Class__c();
            sessIDS= new Set<Id>();
            sfdcRecords=new List<SFDC_Class__c>();
            selectedSessID = ApexPages.CurrentPage().getParameters().get('id');
            pgb=true;
            //System.debug('value is'+pgb);
            system.debug(selectedSessID);
            processIDS(selectedSessID);
	}

            public void processIDS(String sessionIDS){

                if(sessionIDS != null && sessionIDS !='')
                     {
                         List<String> strList = sessionIDS.split(',');
                         for (String s: strList)
                         {
                             sessIDS.add(s);
                         }
                        system.debug(sessIDS);
                     }
            }

            public PageReference fetchRecord(){

                //System.debug('value is'+pgb);
                sfdcRecords=[Select Contact__c from SFDC_Class__c where id=:sessIDS];
                System.debug(sfdcRecords);
                for(SFDC_Class__c sfdc:sfdcRecords){
                    sfdc.Contact__c=sess.Contact__c;
                }
                try {
                    update sfdcRecords;
                    pgb=false;
                    ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO, 'Sessions Instructor are Updated');
                    ApexPages.addMessage(myMsg);
                    //System.debug('value is'+pgb);
                } catch(Exception e) {
                    ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Error, 'There is an error: '+' '+e.getMessage());
                    ApexPages.addMessage(myMsg);
                    System.debug(e.getMessage());
                }
                return null;
            }
}


The above code is for my massupdate button and this button is in the list view now whenever i tried to update multiple records , a trigger in update event get fired and that trigger have simple query to update event but it give me such strange error , see below trigger query.
 
eventList=[Select StartDateTime FROM Event limit 2];
          system.debug(eventList);
          update eventList;


The error is given below, Please help to sort out this problem 

Note: When i try to update a single record(using limit 1) I would not get any error but for multiple records i am getting an error


Update failed. First exception on row 0 with id a08c00000080wefAAA; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CreateEvents: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 00Uc0000003cwSPEAY; first error: INVALID_ID_FIELD, invalid record id: [] Class.MassUpdateInstructor.callTrigger: line 55, column 1 Trigger.CreateEvents: line 238, column 1: []