0

I am trying to figure out a way to dynamically update a custom picklist field called Account.[Region] based on an inputted shipping state (text field). The reason we're not considering a formula field is because we want the Region field to be editable.

I've created a custom metadata type called Region Assignment that illustrates how the Region field should be updated if the corresponding shipping states are inputted by end user.

The Regions should be defined based on the inputted states

I tried a process builder referencing to the Region Assignment custom metadata type but I don't think it dynamically updates the region field. The second thing I tried is creating a flow but I am stuck right at the decision portion of the flow:

  • I am able to create a flow that hosts the incoming shipping state in the *VarT_ShippingState variable (this will be included in a process builder to kick off the flow later)
  • I am able to get region assignments from the custom metadata type and reference each region assignment, and attempted to see if one of the variables contains the VarT_ShippingStates or not

Decision

So far, this flows works up to a point that returns a boolean evaluating whether the custom metadata type contains the incoming variable or not; however, I can't figure out how I can dynamically update the region field based on the assigned shipping states.

Am I heading the wrong direction? Any help on this would be helpful, thanks!

Region Assignment flow

0

While this is definitely possible via flow builder, why not take a simpler approach? Would the following approach work for you?

  1. Create a region field (text) that will be displayed in the new & edit forms.
  2. Create another formula field (to be displayed in the list view or record view form) that will calculate/ find the correct region based on the state input value. This formula field should also consider the user entered value from the text region field. Bare bones formula would be something like:

IF(RegionTextField != NULL, RegionTextField , (Elaborate IF formula to find the region based on state input value))

  1. If the user did not enter any value in the Region text field, update this field value via process builder (based on the formula field value).
| improve this answer | |
0

Thanks for your suggestion! We found a dynamic way (no hardcoding) solution - Posting it here in case if anyone is looking for a similar solution:

Setting Up Custom Metada Type:

Create a custom metadata type called "Region Assignment" with two fields:

  • Region - Text(255)
  • States - Text(255)

Then 'Manage Assignments' and for each subsequent region, we assign the relevant states:

Singular Custom Metadata Type: enter image description here

All of the custom metadata types: enter image description here

Setting Up Process Builder: PB should kick off when a record is created or edited, cover two scenarios that kick off the flow:

  1. When "Shipping State" is changed OR
  2. When "Shipping State" is not null enter image description here

It'd kick off the flow called "State Region Assignment" where the record variable IncomingStudent reference to the Account object (we renamed our Account = Student): enter image description here

In our flow: We only created one extra text variable called "VarT_Region". The other is the record variable called "IncomingStudent". Below is an overview of our flow: enter image description here

Step 1. Get record from the Custom Metadata Type "Region Assignment" where if the PB kicks off the flow (meaning that it's met th criteria that the Account.[Shipping State] is not null and or it's been changed to subsequently meet criteria); We only want the region to be saved when the Region_Assignment__c[States__c] Contains the IncomingStudent.Shipping State; If it does, store it in the text variable VarT_Region. Check that if When no records are returned, set specificed variable to null enter image description here

Step 2. Decision component that checks whether or not the VarT_Region has a match value or not: enter image description here

Step 3. If VarT_Region is not null, then we want to specify and find that specific account/student record and populate the Account.[Region] with the found/assigned region value.

enter image description here

All in all, this should dynamically update the Account.[Region] field based on an inputted Shipping States. This will also avoid hardcoding and is a scalable solution.

If there is another way to do this - please feel free to reach out to me - Thanks!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.