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
rohitrrohitr 

Event records doesn't get updated with data loader

I've a trigger on Event which is fired on insert and update. The trigger updates couple of fields on contact based on event record.

For eg. 

There is a field Number of events, latest event.

 

I was trying to update the historical records too for which i updated a field on event. (this field is just to inititate the update and hence the trigger).

 

But I found that when i update all the event records, it just doesn't update fields on contact, but i see the field is updated on event records.

 

What is happening. Any clues?

Number Event records :1018

Data loader batch size: 200

Bulk API: unchecked.

 

Thanks in Advance

Best Answer chosen by rohitr
Avidev9Avidev9
@rohitr your trigger is not coded to handle bultk records. That is not a good practice. I guess you have already seen the consequences, It will fail whenever there is a bulk update / insert

All Answers

AshlekhAshlekh

Hi,

 

If your trigger fire on Event object  and you want to update contact object record.


Then you have to get the id of that contact record ( WhoId is the field on event object where form you can get this id ) or get that contact object record

 

and make changes in value of contact object record and explicitly update the contact object record.

 

Thanks

Ashlekh Gera

 

If my post help you in any way than don't forget to give me kudo's and mark as a solution.

 

Avidev9Avidev9
Well depends on your trigger code.
Generally developer code their trigger with a check. Like if any value changes in the update then only do an operation. Probably there is a check in your trigger of this kind and since you are doing a blank update it is not updating any records.
rohitrrohitr

Thanks for the Help.

 

Actually when i set the bacth size to 1, everything was ok.

Avidev9Avidev9
@rohitr your trigger is not coded to handle bultk records. That is not a good practice. I guess you have already seen the consequences, It will fail whenever there is a bulk update / insert
This was selected as the best answer