cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Player1
Frequent Visitor

Invalid template indexOf

I started off with using compose but Im getting this error on test so I tried variable but wasn't helpful, you guys have any idea where I might have overlooked things?

 

substring(variables('TxtEmailBody'),indexOf(variables('TxtEmailBody')),variables('DomainName'),9)

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions

 

Hi @Player1 ,

 

Please try the following configuration and expression:

7.PNG

trim(split(split(outputs('Html_to_text')?['body'],'date')[1],'domain')[0])

Feel free to let us know if you have any questions about this method.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
manuelstgomes
Community Champion
Community Champion

Hi @Player1 

 

I think you have too many parameters.

 

The substring needs 3 parameters:

1. text: string

2. startIndex: integer

3. length?: integer

 

You have the variables('DomainName') that is a, I supose, a string and then a 9 so you have 4 parameters.

 

What do you want to do with variables('DomainName')?

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

Thanks for the quick response @manuelstgomes, I though it won't let me save the flow if I have too much parameters and though that I have the right parameters in place:

 

Capture.JPG

 

 

Hi @Player1 ,

 

Could you provide us with sample data of the email body so that we can provide you with a suitable expression to extract the specified data?

 

Does the content of the Email body have a fixed format? Please consider following these similar threads and see if it helps:

Solved: Extracting text from email - Power Platform Community

 

Solved: Extract text from body of an email and create new ... - Power Platform Community

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

HI @Player1 

 

The indexOf is not what you present in your graphic. Check the parenthesis. Here's the start and end of the indexOf.

Capture.png

 

That's why you get the error. You have four parameters and not 3. 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

Hi @v-bacao-msft this is how the email body looks like after converting it to txt, my goal on this expression is to get the 9 digit number on it:


date

234234354

domain[.]net

This domain does not resolve

astrata

2020-08-03

 

I split it previously and got the 'domain' as dynamic content. 

 

 

Hi @Player1 ,

 

Please try the following configuration and expression:

7.PNG

trim(split(split(outputs('Html_to_text')?['body'],'date')[1],'domain')[0])

Feel free to let us know if you have any questions about this method.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-bacao-msft and @manuelstgomes

 

Thank you very much for your inputs and apologies for not responding back quickly but playing around with with flow and what I was trying to achieve have made me realize that my original concept was not reliable if I receive multiple data that I would like to extract/match on a single email body. Hence keep at it and found a more robust approach to go about it and its by using regex to match the data that I want, with patterns.

 

This might be outside the context and subject of my original post but would like to give an update on my journey with power automate as people might be in a similar position. So I receive these emails and its the trigger of my flow converting them from html to text this is how they look:


Registration date

 

123456789

 

blog[.]domain[.]fm

 

2020-08-09

 

223456789

 

domain[.]de

 

2020-08-09

 

now the data that is relevant to me is the nine digit ticket number and their domains. I'm able to parse and match them using plumsail match regular expression:

 

\d{9}|(?<=\d{9}\n\n)\w.*

 

the first part \d{9} matches the nine digit ticket number that I need and the | is OR operation and the last part (?<=\d{9}\n\n)\w.* is matching the domain reported and gives me an output:

 

[
{
"Match0": "123456789"
},
{
"Match0": "blog[.]domain[.]fm"
},
{
"Match0": "223456789"
},
{
"Match0": "domain[.]de"
}
]

 

The problem Im getting now is to actually use the data that I'm matching. As each ticket number and domain are a new match0 using it on apply for each is proving harder than advertised because I want to edit a list that has the Domain with the corresponding TicketNumber in a single row, this is how the data structure of the list looks like:

 

Player1_0-1598271661684.png

 

I tried the named groups which looks easy in some post using the following regex:

 

TicketNumber: (?<TicketNumber>\d{9})
Domain: (?<Domain>(?<=\d{9}\n\n)\w.*)

 

But I'm not getting any matches with this expression and returning as false.

 

 

 

Helpful resources

Announcements

Power Platform Connections - Episode 7 | March 30, 2023

Episode Seven of Power Platform Connections sees David Warner and Hugo Bernier talk to Microsoft MVP Dian Taylor, alongside the latest news, product reviews, and community blogs.     Use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show!      Show schedule in this episode:    0:00 Cold Open 00:30 Show Intro 01:02 Dian Taylor Interview 18:03 Blogs & Articles 26:55 Outro & Bloopers    Check out the blogs and articles featured in this week’s episode:    https://francomusso.com/create-a-drag-and-drop-experience-to-upload-case-attachments @crmbizcoach https://www.youtube.com/watch?v=G3522H834Ro​/  @pranavkhuranauk https://github.com/pnp/powerapps-designtoolkit/tree/main/materialdesign%20components @MMe2K​ https://2die4it.com/2023/03/27/populate-a-dynamic-microsoft-word-template-in-power-automate-flow/ @StefanS365 https://d365goddess.com/viva-sales-administrator-settings/ @D365Goddess https://marketplace.visualstudio.com/items?itemName=megel.mme2k-powerapps-helper#Visualize_Dataverse_Environments @MMe2K    Action requested:  Feel free to provide feedback on how we can make our community more inclusive and diverse.    This episode premiered live on our YouTube at 12pm PST on Thursday 30th March 2023.    Video series available at Power Platform Community YouTube channel.    Upcoming events:  Business Applications Launch – April 4th – Free and Virtual! M365 Conference - May 1-5th - Las Vegas Power Apps Developers Summit – May 19-20th - London European Power Platform conference – Jun. 20-22nd - Dublin Microsoft Power Platform Conference – Oct. 3-5th - Las Vegas    Join our Communities:  Power Apps Community Power Automate Community Power Virtual Agents Community Power Pages Community    If you’d like to hear from a specific community member in an upcoming recording and/or have specific questions for the Power Platform Connections team, please let us know. We will do our best to address all your requests or questions.       

Announcing | Super Users - 2023 Season 1

Super Users – 2023 Season 1    We are excited to kick off the Power Users Super User Program for 2023 - Season 1.  The Power Platform Super Users have done an amazing job in keeping the Power Platform communities helpful, accurate and responsive. We would like to send these amazing folks a big THANK YOU for their efforts.      Super User Season 1 | Contributions July 1, 2022 – December 31, 2022  Super User Season 2 | Contributions January 1, 2023 – June 30, 2023    Curious what a Super User is? Super Users are especially active community members who are eager to help others with their community questions. There are 2 Super User seasons in a year, and we monitor the community for new potential Super Users at the end of each season. Super Users are recognized in the community with both a rank name and icon next to their username, and a seasonal badge on their profile.  Power Apps  Power Automate  Power Virtual Agents  Power Pages  Pstork1*  Pstork1*  Pstork1*  OliverRodrigues  BCBuizer  Expiscornovus*  Expiscornovus*  ragavanrajan  AhmedSalih  grantjenkins  renatoromao    Mira_Ghaly*  Mira_Ghaly*      Sundeep_Malik*  Sundeep_Malik*      SudeepGhatakNZ*  SudeepGhatakNZ*      StretchFredrik*  StretchFredrik*      365-Assist*  365-Assist*      cha_cha  ekarim2020      timl  Hardesh15      iAm_ManCat  annajhaveri      SebS  Rhiassuring      LaurensM  abm      TheRobRush  Ankesh_49      WiZey  lbendlin      Nogueira1306  Kaif_Siddique      victorcp  RobElliott      dpoggemann  srduval      SBax  CFernandes      Roverandom  schwibach      Akser  CraigStewart      PowerRanger  MichaelAnnis      subsguts  David_MA      EricRegnier  edgonzales      zmansuri  GeorgiosG      ChrisPiasecki  ryule      AmDev  fchopo      phipps0218  tom_riha      theapurva  takolota     Akash17  momlo     BCLS776  Shuvam-rpa     rampprakash  ScottShearer     Rusk  ChristianAbata     cchannon  Koen5     a33ik  Heartholme     AaronKnox  okeks      Matren   David_MA     Alex_10        Jeff_Thorpe        poweractivate        Ramole        DianaBirkelbach        DavidZoon        AJ_Z        PriyankaGeethik        BrianS        StalinPonnusamy        HamidBee        CNT        Anonymous_Hippo        Anchov        KeithAtherton        alaabitar        Tolu_Victor        KRider        sperry1625        IPC_ahaas      zuurg    rubin_boer   cwebb365   Dorrinda   G1124   Gabibalaban   Manan-Malhotra   jcfDaniel   WarrenBelz   Waegemma   drrickryp   GuidoPreite    If an * is at the end of a user's name this means they are a Multi Super User, in more than one community. Please note this is not the final list, as we are pending a few acceptances.  Once they are received the list will be updated. 

Register now for the Business Applications Launch Event | Tuesday, April 4, 2023

Join us for an in-depth look into the latest updates across Microsoft Dynamics 365 and Microsoft Power Platform that are helping businesses overcome their biggest challenges today.   Find out about new features, capabilities, and best practices for connecting data to deliver exceptional customer experiences, collaborating, and creating using AI-powered capabilities, driving productivity with automation—and building towards future growth with today’s leading technology.   Microsoft leaders and experts will guide you through the full 2023 release wave 1 and how these advancements will help you: Expand visibility, reduce time, and enhance creativity in your departments and teams with unified, AI-powered capabilities.Empower your employees to focus on revenue-generating tasks while automating repetitive tasks.Connect people, data, and processes across your organization with modern collaboration tools.Innovate without limits using the latest in low-code development, including new GPT-powered capabilities.    Click Here to Register Today!    

Check out the new Power Platform Communities Front Door Experience!

We are excited to share the ‘Power Platform Communities Front Door’ experience with you!   Front Door brings together content from all the Power Platform communities into a single place for our community members, customers and low-code, no-code enthusiasts to learn, share and engage with peers, advocates, community program managers and our product team members. There are a host of features and new capabilities now available on Power Platform Communities Front Door to make content more discoverable for all power product community users which includes ForumsUser GroupsEventsCommunity highlightsCommunity by numbersLinks to all communities Users can see top discussions from across all the Power Platform communities and easily navigate to the latest or trending posts for further interaction. Additionally, they can filter to individual products as well.   Users can filter and browse the user group events from all power platform products with feature parity to existing community user group experience and added filtering capabilities.     Users can now explore user groups on the Power Platform Front Door landing page with capability to view all products in Power Platform.      Explore Power Platform Communities Front Door today. Visit Power Platform Community Front door to easily navigate to the different product communities, view a roll up of user groups, events and forums.

Microsoft Power Platform Conference | Registration Open | Oct. 3-5 2023

We are so excited to see you for the Microsoft Power Platform Conference in Las Vegas October 3-5 2023! But first, let's take a look back at some fun moments and the best community in tech from MPPC 2022 in Orlando, Florida.   Featuring guest speakers such as Charles Lamanna, Heather Cook, Julie Strauss, Nirav Shah, Ryan Cunningham, Sangya Singh, Stephen Siciliano, Hugo Bernier and many more.   Register today: https://www.powerplatformconf.com/   

Users online (1,868)