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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Functions inside Conne...
Power Apps
Unanswered

Functions inside Connector parameters?

(1) ShareShare
ReportReport
Posted on by 48

I'd like to use a function to define parameters inside a Custom Connector API call. 

 

Is it possible to break out of the {} tags and insert a function instead of typing literals? For example

 

 

MyAPI.GetRecords("Accounts",{Filters:"I need my function to replace this string"}).data

 

Categories:
I have the same question (0)
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

     

    Usually you could use

     

     

    With({myFunction:someFunction},MyAPI.GetRecords("Accounts",{Filters:myFunction}).data)

     

     

    If it doesn't let you, then you can't do that and have to use literals.

     

    However, you could also try this:

     

     

    MyAPI.GetRecords("Accounts",{Filters:"I need my" & function & "to replace this string"}).data

     

     

    or this:

     

     

    MyAPI.GetRecords("Accounts",{Filters:$"I need my {function} to replace this string"}).data

     

     

     

    Does any of above help @oguruma ? 

  • oguruma Profile Picture
    48 on at

    I guess the problem really is more of setting variables I can use in the parameters..

     

    Part of the problem is that the actual API accepts a multi-dimensional array, however, for some reason, the Connector will only work if I pass a String. So, I have to simulate the array with a String (the String just happens to contain the multi-dimensional array). 

     

    I have to find some kind of way to store something like ''"company_name"",""="",""Microsoft"" as a variable, then inject that/those variables into the middle of 

     

    MyAPI.GetRecords("Accounts",{Filters:"[[""Status"",""="",""active""], & [""another string here
    ""] & ,"[""maybe one more strong""]]"}).data
    

    ...plus find some kind of way to add the commas in the Filters string to separate the arrays. 

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

     

    //pseudocode - untested
    //an example below
    With
    
    (
    
     {
     myStatusParam:"Status"
     ,myStatusValue:"active"
     ,myCompanyParam:"Company"
     ,myCompanyValue:"Microsoft"
     }
     ,MyAPI.GetRecords("Accounts",{Filters:$"{myStatusParam}={myStatusValue}&{myCompanyParam}=myCompanyValue"}).data
    
    )

     

     

    If you don't like the $ sign syntax, then 

     

     

     

    //pseudocode - untested
    //an example below
    With
    
    (
    
     {
     myStatusParam:"Status"
     ,myStatusValue:"active"
     ,myCompanyParam:"Company"
     ,myCompanyValue:"Microsoft"
     }
     ,MyAPI.GetRecords("Accounts",{Filters:myStatusParam & "=" & myStatusValue & "&" & myCompanyParam & "=" & myCompanyValue).data
    
    )

     

     

    or if you need to keep it exactly in the format you gave, and assuming that it was correct, then like this:

     

    //pseudocode - untested
    With
    (
     {sp:"Status",e:"=",sv:"active",ash:"another string here",moms:"maybe one more string"}
     ,MyAPI.GetRecords("Accounts",{Filters:$"[[""{sp}"",""{e}"",""{sv}""],[""{ash}""],[""{moms}""]]"}).data
    
    )

     

     Try it with the dollar sign syntax, like above, since it's quite a bit more complicated without it:

     

     

     Without dollar sign syntax, it might be like this below, far more complicated than with the dollar sign syntax, and I am less sure it's correct:

     

    //pseudocode - untested
    With
    (
     {sp:"Status",e:"=",sv:"active",ash:"another string here",moms:"maybe one more string"}
     ,MyAPI.GetRecords("Accounts",{Filters:"[[""" & sp & """,""" & e & """,""" & sv & """],[""" & ash & """],[""" & moms & """]]"""}).data
    
    )
    ​

     

    See if it helps as starting point @oguruma 

     

     

  • oguruma Profile Picture
    48 on at

    How do I break out of the "" to insert functions/variables inside of a string?

    For example I have a literal string of 

    MyAPI.Getrecords({filters:"[[""parent"",""="",""LEAD-ID-1234""]]"}).message

    but I'd like to replace ""Lead-ID-1234"" with the variable varSelectedLead.

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    I gave the information already in my previous responses, but I'll now give another example only for the formula you gave and a simpler example this time:

     

    For

     

     

    //untested and assuming your formula works as given
    MyAPI.Getrecords({filters:"[[""parent"",""="",""LEAD-ID-1234""]]"}).message

     

    you can try

     

    //untested pseudo formula, may require modification
    MyAPI.Getrecords({filters:$"[[""parent"",""="",""{varParentValue}""]).message

     

     or

     

    //untested pseudo formula, may require modification
    MyAPI.Getrecords({filters:"[[""parent"",""="",""" & varParentValue & """"]).message

     

    Does it work?

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 Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 977

#2
Valantis Profile Picture

Valantis 664

#3
11manish Profile Picture

11manish 530

Last 30 days Overall leaderboard