function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Antonija MihicAntonija Mihic 

Creating flow for primary contact update on all account types equaling customer?

We have a custom object in our contacts section that says "Primary contact" and it is a checkbox. Each account with account type customer needs to have at least one primary contact. I do not want to create a step where this is ticked in a flow but I do want it to trigger some sort of validation error or message saying you cannot save a record with account type customer unless you have at least one primary contact. I tried to create a flow but haven´t done this before so not quite sure which parameters I need to add. 
Gobinath AGobinath A
Hi Antonija,

You have to create rollup summar for getting the count of primary contact and then create the validation rule like "if the rollup summary count less than 1, make to show the error.". If you are unable to followup, please let me know and I will help you. 

Please contact us, if you need anyother support,

Antonija MihicAntonija Mihic
Hello and thank you for responding! I did not think of roll up summary so thank you for providing this suggestion. I created one at contact level and chose "count" but there is no way I can choose primary contact as the field to count so it looks as if I want to count per column? I chose "all records should be included in the calculation" option since the criteria options did not help me.. Sending a print screen to better show what I did. Maybe I missed something?? Thanks! [image: Screen Shot 2018-10-30 at 09.15.56.png]
Antonija MihicAntonija Mihic
Yes just sent you!
Gobinath AGobinath A
Hi Antoniji,

Please refer this and It will resolve your query. JUST COPY POST THE CODE AND IT WILL WORK FOR YOUR SCENARIO.