You need to sign in to do that
Don't have an account?
Sudhir Dudeja
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.
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: []
On Clicking of Mass update button in list view a backend trigger fire which could not able to update the events records, please take a look at full description [Help]( CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY,VALID_ID_FIELD, invalid record id: [])
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: []
provide me trigger for event code...
Thank you for your reply RAM, below is the code for trigger
As my understand,if possible can you modify ur trigger like below...or if possible tell me the exact functionality of the trigger
Hello Ram,
Thanks for your reply.
My trigger update the events and it was working fine but recently I added a mass update button on list view which is used to update a particular field of a object so whenever I try to mass update the records from the list view my trigger gets fired and in that trigger on update context i am getting an error so I start troubleshooting the error and commented all the code in the trigger update context place simple soql query there which is returning me two records of event and then after that there is update list command.
So its like
mass update button fires ----> trigger and in trigger update context have the below code(the below code is the complete code) but it giving me error (on multple records)as shown above
Code in trigger update works fine if I select one records from list and try to update it but when i select multiple records from the list then i get the error.
preventTriggerRecursion.updatedOnce1()
Hello Ram,
Below is the actual code of my trigger
Now When i am massupdating my records from list view button this trigger get run and i am getting the below error
For troubleshooting purpose i remove all the code in trigger on update context and just add some line which basically test whther i am able to update the event on not so for testing purpose i added the below line after removing all the codes in update context.
Note 1 : When i select multiple records from list view I get an error but when i select one record from lis view it works fine.
Note 2: My trigger works fine when i am updating multiple records through data loader.
Below is the code to prevent the recursive trigger
I actually could not able to out figure why i am getting this strange error, I can't just able to update the event