Ask Search:
Katie DeLunaKatie DeLuna 

HELP! Process Builder!

I'm creating a Process Builder where my object Instance is a many to one relationship to Account.

I created a field on the Instance called "Deployment_Type__c" (picklist) where if the field = Cloud - R1, then update a checkbox on both related Account and Contacts to TRUE.

HOWEVER -

If the deployment type changes to anything else other than Cloud - R1, I need to deselect those checkboxes. Further, since an Account can have many instances (which could include Cloud - R1), i need to ensure that the checkboxes stay checked if the Account has at least ONE instance of Cloud - R1.

Anyone have any ideas? Please help! Urgent request :( 
Best Answer chosen by Katie DeLuna
Mayank SrivastavaMayank Srivastava
Katie, your question inspired me to write a blog post about the requirement design solution:
http://succeedwithsalesforce.com/using-process-and-flows-to-update-parent-record-based-on-all-related-child-records/

I used a more common use case though and you can easily replicate it for your requirement. Good luck!

All Answers

Katie DeLunaKatie DeLuna
I need to esssentially check that there are no other Instance records tied to the Account with a Deployment Type = Cloud - R1
Jeff MayJeff May

If your Process Builder process is watching the custom object "Instance', then it can easily update a checkbox on the related Account.   As long as you don't have a Process builder to 'uncheck' that field, ever, then as long as 1 Instance record caused it to be checked on the Account, it will stay checked.

As for the Contacts, since each Contact is related to an Account, you can use a formula field on Contact that references the related Account checkbox field so your Contacts will always show the right value.

The challenge you have is that the Instance doesn't know about any other instances.  Is the relationship between Instance and Account a Lookup(Account) field on the Instance?  Or a Lookup(Instance) on the Account?

Katie DeLunaKatie DeLuna
  • As long as you don't have a Process builder to 'uncheck' that field, ever, then as long as 1 Instance record caused it to be checked on the Account, it will stay checked.
    • Well, we will want to uncheck that field if that instance record's field of "Deployment Type" value changes.
  • Yes, I can probably use a formula to update the Contact field via the Account
  • Account is a lookup field on the Instance
Jeff MayJeff May
If an Instance always needs to have an Account, then you can change the Lookup(Account) to a Master-Detai(Account). Then, you can create a Rollup Summary field on Account that COUNTs the number of Instances that meet your criteria.

Finally, on the Account record, you can use a formula checkbox field to be TRUE or FALSE based on whether the RollupSummary Count > 0
Katie DeLunaKatie DeLuna
Instance is a Many to One relationship to Account. Account is a lookup field on Instance.
Katie DeLunaKatie DeLuna
Unfortunately, we cannot change the field type on the account. It must stay as is.
Jeff MayJeff May

That is unfortunate.  Any reason why not?  Assuming an Account is always required on Instance, there would be no negative impact.

If you really can't change it to use standard Salesforce functionality, you can take a look at Rollup Helper from the AppExchange that will let you create a Rollup field (sort of) based on the lookup.

Katie DeLunaKatie DeLuna
Becuase it changes the data architect in place and we cant just change something like that on the custom object. :(
Mayank SrivastavaMayank Srivastava
The only declarative way of doing this is to use a Process and Flow. A more straighforward way is to use Apex but that would need developer assistance.

1. The Process would fire everytime an Instance object record is created or edited.
2. The immediate action would then launch a Flow.
3. The Flow would perform the heavy lifting of looping through all of the related Account's Instance records and then accordingly updating the checkbox on the Account record.

I recently did this for a similar requirement using Process and Flow.

Another option is to use a tool like Roll Up Helper or Declarative rollup summaries which would let you create a  Roll Up Summary field even for a lookup relationship and then use the solution that Jeff suggested earlier. (formula field)
Katie DeLunaKatie DeLuna
Is there any way I can create a formula in the process builder that checks IF the account doesnt have an instance of cloud-r1?
Jeff MayJeff May
Nope.  You really need to fix your data model (on the assumption an Account is always needed on an Instance).

Your other non-package choice would be to write a Flow that takes an Instance, gets an Account ID, searches for all other Instances related to that Account, see if any of them have the right criteria, and then update the Account checkbox.  
Katie DeLunaKatie DeLuna
Ive never created a flow. Im wondering how hard that would be? Also, I keep getting a timeout error when trying to create one!
Mayank SrivastavaMayank Srivastava

Umm it's not hard but does take some time to get a good grip at.You are running into a known issue:
https://success.salesforce.com/answers?id=9063A000000DWtd

Issue Link and resolution:
https://success.salesforce.com/issues_view?id=a1p3A0000008fZpQAI

Mayank SrivastavaMayank Srivastava
Katie, your question inspired me to write a blog post about the requirement design solution:
http://succeedwithsalesforce.com/using-process-and-flows-to-update-parent-record-based-on-all-related-child-records/

I used a more common use case though and you can easily replicate it for your requirement. Good luck!
This was selected as the best answer
Katie DeLunaKatie DeLuna
@Mayank cool! Thanks!!!
Katie DeLunaKatie DeLuna
I ended up using flow (with help from a colleague, as it's pretty tricky unless you have some coding background). Thanks, everyone!