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 / Searching a string wit...
Power Automate
Answered

Searching a string within an object

(0) ShareShare
ReportReport
Posted on by 142 Season of Giving Solutions 2025

I have an object output like below that i want to check if the word ORANGE exists on one of the text field. Is there a way to do it without using any loops? Like an expression?

 

{
"@odata.type": "#Microsoft.Dynamics.CRM.expando",
"page": 1,
"lines@odata.type": "#Collection(Microsoft.Dynamics.CRM.crmbaseentity)",
"lines": [
{
"@odata.type": "#Microsoft.Dynamics.CRM.expando",
"text": "APPLE",

{
"@odata.type": "#Microsoft.Dynamics.CRM.expando",
"text": "ORANGE",
"boundingBox": {
"@odata.type": "#Microsoft.Dynamics.CRM.expando",

Categories:
I have the same question (0)
  • SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at

    @powerdevkris ,

    You could try the indexOf function in the expression. If the searchText exists, it returns a positive number

    indexOf(text,searchText)

     

  • powerdevkris Profile Picture
    142 Season of Giving Solutions 2025 on at

    Passing the whole object on the first parameter will hit this error.

     

    Unable to process template language expressions in action 'Compose' inputs at line '0' and column '0': 'The template language function 'indexOf' expects its first parameter to be of type string. The provided value is of type 'Object'. Please see https://aka.ms/logicexpressions#indexof for usage details.'.

  • Verified answer
    SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at

    Maybe use a Compose to convert the object to string.

    Then apply the indexOf function on it.

     

    Option two is to loop through the items in apply to each and just a condition by comparing the "text" value to "ORANGE"

     

  • powerdevkris Profile Picture
    142 Season of Giving Solutions 2025 on at

    This one works for me. Thanks!

     

    Maybe use a Compose to convert the object to string.

    Then apply the indexOf function on it.

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
David_MA Profile Picture

David_MA 245 Super User 2025 Season 2

#2
Expiscornovus Profile Picture

Expiscornovus 207 Most Valuable Professional

#3
trice602 Profile Picture

trice602 170 Super User 2025 Season 2

Last 30 days Overall leaderboard