Linking Custom Object Record to Account Based on Matching Field - Answers - Salesforce Trailblazer Community
Ask Search:
Jabari JacksonJabari Jackson 

Linking Custom Object Record to Account Based on Matching Field

I have a custom object that i'm populating with data. The custom object and the Account object have a common EIN number field. I'd like to create a process that checks the system for the Account with the matching EIN number and then populates the Organization Link field (show in the picture) with the matching Account ID. Whats the best way to accomplish this? Thanks!User-added image
Best Answer chosen by Jabari Jackson
Kyle MoseleyKyle Moseley
Hi Jabari,

You have two options, you could do this with a Apex Trigger to query to an account that uses that same field or

You would create a process builder that calls a visual flow. Steps for this would be:

1. Create a Process Builder on your "IRS Data" object for when the record is created. 
2. Criteria would be that EIN number (ISNULL) = FALSE.
3. Call a visual flow passing in the Record ID and the EIN number as variables.
4. First step in the visual flow would be to lookup Accounts using the EIN number as the search criteria.
5. Store the found Account ID in a variable (acctid) or whatever you would like to call it. 
6. Create an Update Element updating the IRS Data record based on the record ID you passed in with the Account ID variable that you found in the Lookup Account Step.

Let me know if you have any additional questions and if the best solves your question, please remember to mark as "Best Answer"

Thank you. 

All Answers

Kyle MoseleyKyle Moseley
Hi Jabari,

You have two options, you could do this with a Apex Trigger to query to an account that uses that same field or

You would create a process builder that calls a visual flow. Steps for this would be:

1. Create a Process Builder on your "IRS Data" object for when the record is created. 
2. Criteria would be that EIN number (ISNULL) = FALSE.
3. Call a visual flow passing in the Record ID and the EIN number as variables.
4. First step in the visual flow would be to lookup Accounts using the EIN number as the search criteria.
5. Store the found Account ID in a variable (acctid) or whatever you would like to call it. 
6. Create an Update Element updating the IRS Data record based on the record ID you passed in with the Account ID variable that you found in the Lookup Account Step.

Let me know if you have any additional questions and if the best solves your question, please remember to mark as "Best Answer"

Thank you. 
This was selected as the best answer
Jabari JacksonJabari Jackson
Hey Kyle, 

Thanks so much for your quick response! Your steps for creating the visual flow makers sense. I'm going to put this together and test. Thanks again!
Lu EnstadLu Enstad
Hey Jabari,

I know it's been a year, but I have an identical task to what you described above and I'm stuck on how to set up my flow. If you ever got this to work and could show me how you did it, I'd be so grateful!

Lu
Jabari JacksonJabari Jackson
Hey Lu,

Sure thing, happy to help if I can. What part of the process are you stuck on?

-Jabari
Lu EnstadLu Enstad
TY!

I have custom account object that is being created via API and will have a field pre-populated called "account_domain". Upon creation of this new account object, I need to match that account object to it's corresponding account by domain. For every custom account object created, there will be one (only one) corresponding account that I need to match it to based on domain.

So far in process builder, I have it set up to begin upon creation of the new custom account object. For criteria, I set the condition to be that the "account_domain" field is not null. Then, I believe my next step is to create a flow. 

In my flow (I'm in the newer version by the way), I chose the "Get Records" option, which I think is what used to be called "Lookup". Under Get Records of this Object, I chose the standard Account object. 

Under Filter Account Records, I figured this is where I would set a condition to search for the "account_domain" field on the account, but this is where I'm not understanding the logic. How do I set up the flow to search for account the account in SFDC that has the same field value for "account_domain" as my newly created custom account object?
Jabari JacksonJabari Jackson
Hey Lu,

Were you able to create variables for the standard account domain and the account ID in the flow? (you'll also have to pass the variables from to the flow from the process builder)

At the begning of the flow you can lookup the custom object that has a domain matching the variable you create for the domain on account object.

Next you can create a step that updates the custom object with the account ID from the account with the matching domain. (assuming you have a lookup field to the account on the custom object). Here's a screenshot of the flow launch from process builder and the first step of my flow. Let me know if you have questions.

User-added image
User-added image


 
Lu EnstadLu Enstad
Jabari, this was SO helpful! The piece I was missing was setting up the variables correctly and then referencing the fields in process builder. The screenshot you provided was exactly what I needed. I was able to set it up successfuly, thanks again!
Jabari JacksonJabari Jackson
That's awesome! Glad it worked!