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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Power Automate: Check if regardingobjectid's type is contact

(0) ShareShare
ReportReport
Posted on by 54

Hello, 

I have a flow that creates a lost opportunity on the background of a additional sales phone call, if our advisors doesn't get any sales that call. 


The flow is triggered on create of phone call activity and checks if a two-option field is checked. When this is checked, the flow creates a new opportunity and closes it as lost. 
I have a couple problems here. The call from ('from') and call to ('to) fields aren't accessible in the trigger. I have two fields to populate - account and contact. These fields should get the regarding value based on which type the regardingobject id has. I have tried running this expression, but I only get an invalid expression error. 

if(triggerOutputs()?['body/_regardingobjectid_value@Microsoft']?['Dynamics']?['CRM']?['lookuplogicalname'] equals 'accounts', triggerOutputs()?['body/_regardingobjectid_value'], false)
This expression checks if the regardingobjectid's type is of Account. If so, add the regardinbobjectid's value, if not null/false (do nothing).
Can anyone see why this expressions is invalid?
Looking forward to any replies that can help me in the right direction.
Best regards, 
Marius
I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Mariusssf,

    Not using expression to get regarding type, you can add one ‘Get a row by ID’ step before getting regarding type, which can be more easily.

    1.You can refer following screenshot and steps:

    pastedimage1622450465676v2.png

    2.Result:

    pastedimage1622450508485v3.png

    3.For the sake of testing rigor,i add another one 'compose' after trigger:

    Compose1 has value and compose2 is null.

    pastedimage1622450607202v4.png

    4.Then you can add one condition after compose to do following actions:

    pastedimage1622450774528v5.png

    5.Test:

    pastedimage1622450811132v6.png

    Regards,

    Leah Ju

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

  • Mariusssf Profile Picture
    54 on at
    [quote user="Leah Ju"]

    Hi Mariusssf,

    Not using expression to get regarding type, you can add one ‘Get a row by ID’ step before getting regarding type, which can be more easily.

    1.You can refer following screenshot and steps:

    pastedimage1622450465676v2.png

    2.Result:

    pastedimage1622450508485v3.png

    3.For the sake of testing rigor,i add another one 'compose' after trigger:

    Compose1 has value and compose2 is null.

    pastedimage1622450607202v4.png

    4.Then you can add one condition after compose to do following actions:

    pastedimage1622450774528v5.png

    5.Test:

    pastedimage1622450811132v6.png

    Regards,

    Leah Ju

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

    [/quote]

    Hi Leah Ju.

    Thank you for your reply. I do however have to use the expression to solve my issue, I think (?). I'll explain it in more detail.

    My org. has set up contact/account to be contact - private customers and account - business customers. Kinda wrong use of the entities, but that's not what's relevant here. When creating an opportunity there are one lookup field for each of the customer groups, contact and account.

    pastedimage1622539349838v1.png

    Both these are business required, with a script running that once one of those fields contains a customer, the other becomes read-only and is no longer business required. So when adding a new row for opportunity in the Flow both of these are business required.

    pastedimage1622539349839v2.png

    This is why I am trying to use an expression on the fields, something like this: If regarding type == 'account' -> set regarding value, if not do nothing. The same expression will go for the contact field in the flow. The phone call that triggers the flow will always be created from the customer form, so regarding type will always be account or contact. 

    Any suggestions on how to solve this is highly appreciated.

    Regards, 
    Marius

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
Pallavi Phade Profile Picture

Pallavi Phade 102 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2026 Season 1

#3
ManoVerse Profile Picture

ManoVerse 53 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans