web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Workflow to determine if a Customer is a Contact or Account?

(0) ShareShare
ReportReport
Posted on by 1,589

I created a Customer field on the Opportunity Entity that allows for the selection of an Account record or a Contact record.

Is there an OOB method I can use in a workflow to determine if the Customer field contains a Contact or an Account?

I need to do certain things if the Customer is a Contact and other/different things if the customer is an Account. 

How can I make this determination using a workflow with only OOB components?

I have the same question (0)
  • Suggested answer
    Adrian Begovich Profile Picture
    1,027 Moderator on at

    Hi Jim Aloye,

    You will need to use custom code to meet this requirement.

    var customer= Xrm.Page.getAttribute("customerid").getValue();
    var customerType=customer[0].entityType;

    Assuming that the lookup is already populated, this JavaScript code will store a value of "account" or "contact" in the customerType variable depending on the entity type of the lookup record.

  • Verified answer
    Community Member Profile Picture
    on at

    Hi Jim,

    Unfortunately, you can’t determine customer is account or contact with workflow.

    But you can use flow to achieve it, just as following screenshot:

    pastedimage1607318797099v1.png

    Go Power Automate(https://us.flow.microsoft.com/en-us/ )

    Then you can do other operations under ‘yes’ or ‘No’ branch.

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • ACECORP Profile Picture
    1,589 on at

    I was able to determine if the Customer is a contact or account using the method below. 

    If the Customer(Contact) Field is Populated

    • If Customer (Contact):Address 1 contains data, then:
      Do the contact related stuff via child workflows because you know its a contact

    • Otherwise, if Customer (Account):Address 1 contains data, then:
      Do the account related stuff via child workflows because you know its an account

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 62 Most Valuable Professional

#2
#ManoVerse Profile Picture

#ManoVerse 57

#3
Pallavi Phade Profile Picture

Pallavi Phade 49

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans