I have a before insert trigger on leads that translates a few fields that are populated from a web form that is translated into multiple languages. This is working well.

If there is no matching translation found, I want to flag the record as having an error so it can be resolved. I would like to log an activity for this, to avoid cluttering up the object with fields for specific integrations. However, it seems like this is not possible because I cannot access the Id in a before insert trigger, so I cannot related the activity to the lead.

Is the only option to use a field on the lead to flag issues? Is there some trick to this that I am missing?

This must be a before insert trigger because some of the fields are restricted picklists, and the translations must process before the insert. The trigger sets the picklist to null if there is no matching translation to allow the lead to be inserted.

1 Answer 1


If it must be on a before trigger, then you're out of luck. On insert, the record won't have an Id until the after trigger.

Why don't you still leave the processing of the translations to the before trigger, but also add some checking in the after trigger to see if there's a translation, and if there's not, create the activity?

  • Thanks I was considering flagging in the before trigger and then logging an activity in an after but as that requires a field anyways I might as well just stick w the flag on the lead and let it go, as the song goes.
    – gorav
    Commented Sep 22, 2021 at 10:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .