3

I have a process where a Photographer provides an Excel sheet with all the zip codes of the locations they're willing to take pictures in. Currently we have to massage and data load that data.

Is there a way using Visual Flow I can enter a list of Zip Codes and have it loop through the list to create a record?

The Object is called Resource Zip Code and has 2 fields: Resource__c (Lookup: Contact) {This is passed in via URL in Flow},
Zip_Code__c (Lookup: Zip Code)

Here's an example of the Flow: enter image description here

Thoughts?

3 Answers 3

6

Sure you can. Roughly the steps would go like this.

  1. Create a screen element with a long text area input field.
  2. Link it to a decision element to see if the field is empty. If it's not (shouldn't be in the beginning) do:
    1. Assign the first value of the field to a variable (using a formula to split the list of postal codes along your preferred character (line break, space, comma)
    2. Create a look up element to see if the value is valid. If not, ask the user to correct it in a screen, and check again if the new value is valid.
    3. Create a resource zip record.
    4. Assign the record to a collection of record zip.
    5. Remove the processed value from the total string. (Using an assignment element and a formula.)
    6. Go back to the decision in the first step 2 to see if the field is empty.
  3. If the field is empty insert the resource zip collection.

Extra explanation about step five:
Say you have five zipcodes: 12345 54321 67890. You can then find the first postal code by using the following formula:

TRIM(LEFT(longTextAreaPostalCodes, FIND(" ", longTextAreaPostalCodes))) 

You use that value to create your resource zip record.

Then after that you need to remove that value from the long text variable so you don't process it again. You can do that with a similar formula.

TRIM(RIGHT(longTextAreaPostalCodes, LEN(longTextAreaPostalCodes) - FIND(" ", longTextAreaPostalCodes)))

After that you go back to finding the next value. If there is one you process it in the same way, if there's none, than you insert the created records.

5
  • Hey Kasper, thanks for answering. Can you shed some light on step 5? How I'm not sure I understand how to accomplish that. Commented Dec 20, 2017 at 20:26
  • I've added an image to the thread Commented Dec 20, 2017 at 21:06
  • Sure @CoryO.Bennett. I've added some further explanation on step five. I hope it helps.
    – Kasper
    Commented Dec 20, 2017 at 23:16
  • @Kasper I am trying to follow same steps but stuck in step 5. We can not use formula field in an assignment so how we will remove the processed value ?
    – Aakriti.G
    Commented Oct 16, 2019 at 7:58
  • @Aakriti.G You should have the variable on the left that contains all the unprocessed items. You then assign that variable the value of the formula that removes the value you have already processed. That should work?
    – Kasper
    Commented Oct 16, 2019 at 14:24
0

enter image description here

Here's what I've come up with so far

0

Thanks @Allison Letts, I was wondering if this is even possible.

There is a catch though, in case delimiter is not space but something else, let's say comma. This will end up in infinite loop. To fix this I did small change as below

Formula to get first element

TRIM(LEFT({!Concatenated_Value}, FIND(",", {!Concatenated_Value})-1))

Removal of used element from entire string

IF(FIND(",", {!Concatenated_Value})!=0, TRIM(RIGHT({!Concatenated_Value}, LEN({!Concatenated_Value}) - FIND(" ", {!Concatenated_Value}))), "")

You must log in to answer this question.

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