You need to sign in to do that
Don't have an account?
Frédéric Provot
Setting BillingState and BillingStateCode together causes both fields to be null
Hi.
A problem that appears this month in production as well as in sandboxes : If you create an account and set (unusefully) both BillingState and BillingStateCode fields (with the same entry of course), AND have a workflow or a Process Builder that updates some other field(s), then both BillingState and BillingStateCode are finally empty (null).
Step to reproduce:
I set some debug logs on account trigger which tell (tracing trigger.old/trigger.new):
BEFOREINSERT :
the new record have BillinStateCode and BillingState set.
AFTERINSERT :
the new record have BillinStateCode and BillingState set.
BEFOREUPDATE :
the old record have BillinStateCode and BillingState set.
the new record have BillinStateCode and BillingState set.
AFTERUPDATE :
the old record have BillinStateCode and BillingState set.
the new record have BillinStateCode and BillingState UNSET (null). (NOT BY OUR CODE)
NEXT BEFOREUPDATE :
the old record have BillinStateCode and BillingState UNSET.
the new record have BillinStateCode and BillingState UNSET.
I also made tests to read the record from DB at each step, which confirm this.
So there is a problem at DB persistence time during first update.
This is just to mention as I spent a lot of hours narrowing the problem.
Regards
A problem that appears this month in production as well as in sandboxes : If you create an account and set (unusefully) both BillingState and BillingStateCode fields (with the same entry of course), AND have a workflow or a Process Builder that updates some other field(s), then both BillingState and BillingStateCode are finally empty (null).
Step to reproduce:
- Notice a country having some states (in State & Country picklist management).
- Create a unit test that just insert a new account, with both BillingStateCode and BillingState fileds set. And which then read the account and display all its fields.
- Create a workflow or a process builder that updates a field on accounts at creation.
- Run the test.
I set some debug logs on account trigger which tell (tracing trigger.old/trigger.new):
BEFOREINSERT :
the new record have BillinStateCode and BillingState set.
AFTERINSERT :
the new record have BillinStateCode and BillingState set.
BEFOREUPDATE :
the old record have BillinStateCode and BillingState set.
the new record have BillinStateCode and BillingState set.
AFTERUPDATE :
the old record have BillinStateCode and BillingState set.
the new record have BillinStateCode and BillingState UNSET (null). (NOT BY OUR CODE)
NEXT BEFOREUPDATE :
the old record have BillinStateCode and BillingState UNSET.
the new record have BillinStateCode and BillingState UNSET.
I also made tests to read the record from DB at each step, which confirm this.
So there is a problem at DB persistence time during first update.
This is just to mention as I spent a lot of hours narrowing the problem.
Regards