The scenario is:
- I have an autonumeric field
Perspective_Code__c
. - I have a text field
Original_AC_Code__c
. - I have an external id text field
Opportunity_Code__c
.
When a record is inserted/updated, I need to calculate Opportunity_Code__c
depending on: if Original_AC_Code__c
has value, Opportunity_Code__c equals to Original_AC_Code__c
else, Opportunity_Code__c
equals to Perspective_Code__c
.
I cannot use a formula field to calculate Opportunity_Code__c
because is necessary have the field as external id.
I cannot use a before trigger because, on insert, I don't have Perspective_Code__c
value.
I cannot use an after trigger because I need to update the same record being processed.
I cannot use a workflow because, on insert, Salesforce doesn't guarantee the Perspective_Code__c
field has value when executing.
Someone can help me how/when I can use an autonumeric field to complete another text field?
Thanks!