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 / Trying to compare an o...
Power Automate
Unanswered

Trying to compare an object property using Switch

(0) ShareShare
ReportReport
Posted on by 27

I have a List in a SharePoint site that contains work orders and one of the fields is a Person object named Technician. I'm trying to build a flow so that when that Technician field changes, it sends a Teams message to the technician.

I tried to use the Switch function On Technician, but the cases only allow for text, so the comparison fails.

I know the Technician object has a property "DisplayName" that I can use for the comparison, but I can't figure out how to write that out.

I figure I'd have to put something like the following in the Switch On test: Technician.DisplayName, but can't figure out the correct format.

 

Categories:
I have the same question (0)
  • Ian-Murphy Profile Picture
    27 on at

    I tried to delete this post, as I sort of figured this out.

    I initially used the String(Technician DisplayName) function, which somehow changed into 

    string(triggerBody()?['Technician']?['DisplayName']) as I wrote it out. Later, upon saving the flow, it changed again to body('Get_item')?['Technician']?['DisplayName'] which somehow now worked, even though it was no longer converting it to a string?
    No idea why the expression changed twice, or why it still works, but it does.
    So, I no longer need any help getting it to work, but I'd certainly be interested in knowing why it works, now.
  • Verified answer
    v-xiaochen-msft Profile Picture
    on at

    Hi @Ian-Murphy ,

     

    According to your third formula, I know that you used sharepoint's 'get item' action.

    The action returns an object. (Object is a data type.)

    The object has many properties, including ’Technician‘.

    At the same time ,'Technician' is a person column. It also returns an object. The object contains a 'DisplayName' property.

     

    So, If you have an object in flow and it has a column 'Test', you could use the formula like this:

    Object?['Test']

     

    You don't need to use string() function. Because the DisplayName of an object is a string already.

     

    Best Regards,

    Wearsky

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard