0

I am trying to figure out the best way to achieve the following requirement:

I have a Object1 that I create a record checking or not 5 checkboxes as applicable. Example:

Name: 0002x9
Arrow (checked)
Bee (not checked)
Castle (checked)
Durable (not checked)
Entrance (not checked)

In the other hand, I will need to create the variations in object2.
record 1: name = 0002x9 - Arrow
record 2: name = 0002x9 - Castle

For those i did not select the checkbox in the object 1 will not create a variation in object 2. And if I diselect a checkbox (once it has already been selected) the record created in Object 2 needs to become "Inactive")

I need to always check if the record (variation) in object 2:
already exists - update (active or inactive),
does not exist - create.

How could I achieve that using flow + process builder?

1

This would best be done by having Process Builder call an autolaunched Flow passing in the Object1 RecordId.

In the Flow you would have

  1. lookup at the start and retrieve the Object1 fields into flow variables.
  2. lookup on Object2 to retrieve anys records with the name matching Object1 name into an sObject variable.
  3. Loop through the sObject variable to see if an object2 record exists with Arrow
  4. If the Object2 record exists and arrow variable is unchecked then make it inactive
  5. If the Object2 record does not exist with arrow then create a new record using the necessary values from Object1.
  6. Repeat steps 3-5, but searching for each of the other checkboxes.
2
  • Hi Dave, thanks so much for your promptness. Could you please help me understand if the following concern makes sense and how to map that? Object 1, UniqueID = KEY-092. In Object2 i will need to have this Object1 UniqueID reference in all variations of the record, makes sense? If so, even I have selected the checkebox for Bee once, then edited the record in object t2 selecting the Arrow box. In my record lookup It will appear as already have the ID in object2... no?
    – susaneme
    Jun 23 '16 at 13:39
  • I've updated the answer to allow it to update any matching records by iterating through the set of them.
    – Dave Humm
    Jun 23 '16 at 13:54

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.