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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to check if Custom...
Power Automate
Answered

How to check if Customer field is of type Account or Contact

(0) ShareShare
ReportReport
Posted on by 147

Hi,

 

I have been looking around a bit for my question but haven't had any luck so far.

 

In my head, this should be pretty straightforward but is giving me trouble...

 

So I have a Flow where I need to set a variable depending on whether the Customer field is a type of Account or Contact.

I can't get my condition to work properly - it's returning false every run. And I'm 100% sure that the case has an "Account" in the Customer field.

 

I have tried the following conditions:

Customer (Value)is equal toAccount
Customer (Value)is equal toaccount
Customer (Value)is equal toaccounts
Customer (Type)is equal toAccount
Customer (Type)is equal toaccount
Customer (Type)is equal toaccounts

 

Here is a screenshot of my flow.

2020-12-16 12_08_51-Window.png


Can someone please explain to me what I'm doing wrong?

 

Thanks!

Categories:
I have the same question (0)
  • Paulie78 Profile Picture
    8,422 Moderator on at

    Go into your run history, check the output of the trigger step "When a record is created, updated or deleted". From that you will be able to find the exact property and value that you need to be matching. If you find that bit and post the result here it will be easy to make your condition.

  • l.oliver Profile Picture
    147 on at

    Hi,

    Thanks for reply.

     

    Here is the case body output:

    case body.png

     

    and here is how I would set the condition:

     

    condition.pngfinal condition.png

     

     

  • Paulie78 Profile Picture
    8,422 Moderator on at

    based on your screenshot you would expect "accounts" to be an equal match. Try creating a compose step before the condition which just outputs "Customer (Type)" from the dynamic content an call it "customerType". Then you will be able to use that value on the left side of the condition, and also see what it was set to before the condition takes place. The other thing you might try on the right side of the condition is an expression of:

    string('accounts')

    and see if that produces a different result.

     

  • l.oliver Profile Picture
    147 on at

    Thanks for the quick reply.

     

    I have done the following without any luck:

    compose.png

     

    But I'm not too familiar with the "compose" action so I might be misunderstanding something.. 🙂

  • Paulie78 Profile Picture
    8,422 Moderator on at

    You did it correctly, when you look in the run history, what is output of the compose? Did you also try what I mentioned about and put the expression:

    string('accounts')

    On the right side of the condition?

  • l.oliver Profile Picture
    147 on at

    This is my compose output:

    compose output.png

    And when I Click to download it opens up a new "about:blank" webpage. All blank. Really weird..

     

    And yes, I also tried with the string('accounts')

  • Verified answer
    Paulie78 Profile Picture
    8,422 Moderator on at

    That explains a lot! 😁

    What happens if you put this expression in the compose action:

    triggerOutputs()?['body/_customerid_type']

    That may not be right, a partial guess as you didn't post your complete output of the trigger action. But might work.

  • l.oliver Profile Picture
    147 on at

    Thank you very much @Paulie78 !

     

    That expression did the trick!

     

    Would I be able to use that expression directly in the condition? Or do I need the compose step action?

  • Paulie78 Profile Picture
    8,422 Moderator on at

    You do not need the compose step, that was just for troubleshooting/visibility purposes, feel free to delete it and put the expression in the condition.

  • shaboo Profile Picture
    65 on at

    Find the way to get the customer record for an entity.

     

    Example: I want to get the contact - customer lookup this can be account or contact else blank. 

    Step 1 : Get the contact record by contact id and select "_parentcustomerid_value" to return at least, can be ignored that will give full list of fields

     

    Step 2 : Run the flow take the output of the flow action from above step and copy body on to Parse Json.

    content use out put from get contact details - body & generate sample.

    Shaboo992_0-1639071118352.png

     

     

    Step 3: Important step to identify customer lookup logical name - Compose date oprator user - body('Parse_JSON')?['_parentcustomerid_value@Microsoft.Dynamics.CRM.lookuplogicalname that returns lookup logical name in case if you want get the out put as null use coalesce it returns value if blank coalesce(body('Parse_JSON')?['_parentcustomerid_value@Microsoft.Dynamics.CRM.lookuplogicalname'],'none')

    Shaboo992_1-1639071118211.png

     

     

     

    Step 4: Use switch statement and use output of the compose to branch the contact or account else default to get the record values

     

    Step 5: Get contact or account details

     

     

    Shaboo992_2-1639071118822.png

     

     

    If you find useful please thumbs up.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard