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 / Creating custom functi...
Power Automate
Unanswered

Creating custom functions or finding an alternative

(0) ShareShare
ReportReport
Posted on by 54

Dear community,

I am currently trying to clean up some of my flows. In one of them, I use a structure template and fill it with different data depending on different decisions. So this entire structure is being copied multiple times during the flow and dynamic content is added based on the previous decisions or filters.

I'd like to create a custom function including the structure that I can call, instead of copying the entire structure code all over the place.

 

Simplified example:

"My name is {x} and I am {y} years old."

function_name(Lisa,20)

"My name is Lisa and I am 20 years old."

 

I cannot find any solutions to this problem, maybe I am looking for the wrong keywords?

Tyvm.

 

Categories:
I have the same question (0)
  • grantjenkins Profile Picture
    11,063 Moderator on at

    To my knowledge you can't create custom functions as such.

     

    The only way I can think would be to create a Child Flow that took in certain input and returned the relevant output using the input you provided.

     

    Or setting up an Office Script to do something similar, but not really designed for this sort of thing.

     

    Can you not just use the concat expression to get what you want? Or are you trying to get around that.

    concat('My name is ', variables('name'), ' and I am ', variables('age'), ' years old')

    grantjenkins_0-1669513649288.png

     

     

  • VictorIvanidze Profile Picture
    13,073 on at

    I doubt you are really need a "custom function".

    Simplified answer is something like this JSON array:

    [
    {"name":"Lisa","age":20},
    {"name":"Lenny,"age":30},
    ...
    {"name":"Solomon","age":120}
    ]

     

  • TCh1987 Profile Picture
    54 on at

    Hello,

    thank you for your reply.

    Why exactly do I need concat here? I could very well just compose the text with the dynamic content of the two variables and get the same output while keeping the structure cleaner?!

     

    I don't think this is going to help me though. Imagine you have to fill your compose at 10 different spots in your flow and now want to make a change to your initial structure from

    "My name is {x} and I am {y} years old."

    to something like

    "Hello, my name is {x} and I am {y} years old."

    I would have to make that change at 10 different locations, hence my idea of creating a custom function where I can easily change my structure, call it and fill it with information.

  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    Yea true - you could just write it directly in your Compose. I do a bit of both (direct and concat) depending on the circumstances.

     

    As mentioned before, no easy way to create a custom function. Child flow that would require an HTTP connector (premium) that you could pass info into and get a response back, or Office Script that would do a similar thing.

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