Below is an excerpt from the documentation:

When you add or update an account or lead, a D&B Company record is created and linked to that account or lead via the D&B Company field. Click the link in the D&B Company field to access the associated D&B Company record.

Let's say a D&B company record was just created or updated because I updated (or added) a DUNS number field under an account record (let's call this account1). Inside of this newly created D&B company record, there is a parent company DUNS number field.

If our salesforce org has an existing account2 with DUNS number that matches above parent DUNS number, the account2's 18 digit account ID must be added to the account1's parentID field.

If I were to use SQL that might look something like:

account2.18_digit_ID as 'parentAccountID'
FROM d&bcompany
JOIN account1 on d&b_company.DUNSnumber = account1.dunsnumber
JOIN account2 on d&b_company.parentDUNSnumber = account2.dunsnumber

If I were to use this query, account1's parent field must be updated to the values under 'parentAccountID' column.

I was able to successfully set critiera and conditions using the process builder. the final step is to update or insert account1's parent field to an account number SF was able to find based on the parent DUNS number.

  1. Is there a way to implement the SOQL query while using the workflow (whether it be process builder or flow)? if so, can you walk me through where to query in the workflow process? Is Process Builder the right tool in this scenario?
  2. Or Do I have to use APEX? if so, can you briefly explain the process?
  3. Or Is there other better way to tackle this case?
  • I believe you need an auto-invoked flow to do a fast lookup (via Process Builder).
    – Adrian Larson
    Commented Mar 22, 2017 at 21:12

1 Answer 1


The simple approach is you have to use Flow to manage you logic. Use Flow to find the parent DUNS number and the use another record lookup element to find account2 for parent DUNS.

Once you have the account2 id use record update element to update parent field on account1.

  • Thanks! This is exactly going to the direction I need. I understand that the flow requires some sort of user input through a separate screen. I want the process to start whenever the the account DUNS# field (which is lookup to d&b object) is updated or inserted. I guess the workflow rule criteria should work except the workflow rule won't just find the parent DUNS number. Is there any way to manipulate flow to find DUNS and accountID? THanks! Commented Mar 22, 2017 at 22:40
  • You can start a Flow either from user intervention (i.e. custom button etc.), From a Process Builder or Apex automatically. In your case create a Process on Account object and then kick off your Flow
    – J Doe
    Commented Mar 22, 2017 at 22:55

You must log in to answer this question.

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