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 Automate / Sequential Number With...
Power Automate
Unanswered

Sequential Number Within File Title When Creating a New File from Response Submission

(1) ShareShare
ReportReport
Posted on by 4

I have a flow set up that when a new MS Form is submitted, the inputs go into an Excel template and creates a new file that is stored within a team group page in MS Teams. The problem I can't seem to resolve is that with each new submission/file creation, the intent is to generate a unique file name that includes a generic name, followed by the year and the next sequence number available (for example EPBA 2024-001, then the next file would be EPBA 2024-002). 

 

The error that most commonly occurs (after the first document is created) is that the flow fails because the unique file name is already in existence. Typically when this happens, the "compose-Number" action is showing an input and output value of 1 (aka the 'number' portion of the title is not increasing as intended). I have tried quite a few different ways to try resolve this (including utilizing 'increment variable'), and appreciate help to solve this. 

Categories:
I have the same question (0)
  • creativeopinion Profile Picture
    10,508 Moderator on at

    @an2 The coalesce() function in your expression is unnecessary in your case as every item/file will have an ID. For the Get Items action, have you defined a filter query? 

     

    I would recommend appending a timestamp to your file instead. I cover how to do that in the YT tutorial linked below. I've also included a few other tutorials you might be interested in. If you still run into issue with your flow. Feel free to upload a screenshot of where you are stuck.

     

    How to Get Microsoft Form File Uploads Attached to an Email 📧

     

    In this Microsoft Power Automate Tutorial I’m going to cover where file uploads from your Microsoft Forms are saved. I’ll also show you how attach the uploaded files to an email and how to dynamically name the files and customize the recipient of the email based on the selections made in your Microsoft Form. I will also cover how to handle responses that don’t include any file uploads.

     

    IN THIS VIDEO:

    ‌ Two types of MS Forms

    ‌ Where Microsoft Personal (OneDrive) Form File Uploads are Saved

    ‌ Where Microsoft Group Form File Uploads are Saved

    ‌ How to Add a File Upload Question to an MS Form

    ‌ How to get a Microsoft Form ID

    ‌ How to get a Microsoft Form Response

    ‌ How to Get the Dynamic Content Microsoft Form File Upload Content

    ‌ How to handle Single and Multiple Microsoft Form File Uploads

    ‌ How to use a Scope action to Organize and Group Your Flow Actions

    ‌ How to Get the File Content from an MS Form File Upload

    ‌ How to Collect All Files Uploaded to a MS Form and Attach to an Email

    ‌ How to Handle MS Form Response When a File Isn’t Uploaded

    ‌ How to Create an Email Key

    ‌ How to Send an Email to a Specific Recipient Based on Form Selection

    ‌ How to Create a Dynamic Output Based on Form Selection

     

    -----

    How to Add Microsoft Form File Uploads to a SharePoint List Item

     

    In this Microsoft Power Automate Tutorial I’m going to cover how to add file uploads to a SharePoint list item. First, I’ll show you how to get the file name and content from the File Uploads from your Microsoft Form, then I’ll show you how to add those files to a SharePoint item.

     

    IN THIS VIDEO:

     Two types of MS Forms

     Where Microsoft Personal (OneDrive) Form File Uploads are Saved

     Where Microsoft Group Form File Uploads are Saved

     How to Add a File Upload Question to an MS Form

     How to get a Microsoft Form ID

     How to get a Microsoft Form Response

     How to Get the Dynamic Content Microsoft Form File Upload Content

     How to handle Single and Multiple Microsoft Form File Uploads

     How to use a Scope action to Organize and Group Your Flow Actions

     How to Get the File Content from an MS Form File Upload

     How to Collect All Files from Multiple File Upload Questions

     How to Handle MS Form Response When a File Isn’t Uploaded

     How to Attach an MS Form Single File Upload to a SharePoint List Item

     How to Attach Multiple MS Form File Uploads to a SharePoint List Item

     How to Attach MS Form File Uploads to an Email

     

    -----

     

    How to Get a Microsoft Form RSVP Response into a SharePoint List

     

    IN THIS VIDEO:

     How to get a Microsoft Form Response into SharePoint

     How to get a Microsoft Form ID

     How to get a Microsoft Form response

     How to Build a Microsoft Form with Conditional Fields

     How to used Branching in Microsoft Forms

     How to format Microsoft Form multiple choice responses for a SharePoint multi-choice column

     How to parse a Microsoft Form multiple choice response as string of text

     How to convert a text response to a number

     How to use the Switch action

     How to create a custom email confirmation for a Microsoft Form submission

     How to Create a Custom View in a SharePoint list

     How to use the Compose Action

     How to write Power Automate Expressions

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram
  • an2 Profile Picture
    4 on at

    @creativeopinion - Yes, if I use a timestamp I know it works, however this flow needs the unique title numbering since that name (i.e. EPBA-2024-002) is referenced in other work applications. The flow is also set up that once the 'number' variable is set, it populates into the Excel template as it's creating the file. 

  • creativeopinion Profile Picture
    10,508 Moderator on at
    Without seeing the Get Items action expanded—it's hard to tell whether or not you have defined a sort order, or a filter query. The Get Items action will return an array of items, even if it's a single item. By default the items are sorted by ID. Which means that the first item returned would return an ID of 1.
     
    Add a Compose action to output the first ID from the Get Items action. You'll need to use the the array index of [0].
     
     
     
    Run a test. ID 1 is returned.
     
     

    Define a Sort Order

    Now, define a sort order. Order the items by ID in descending order.
    Run another test. Without changing the expression, the last item ID in my list is returned.
     
    If the output isn't what you are expecting, you may need to toggle on pagination. By default the Get items action returns a maximum of 100 items. If your list set contains more than 100 items and you need to retrieve them all, you would need to toggle on pagination for the Get Items action and set a threshold.
     
    Note: The number output in the Compose action is green which indicates it's an integer. 
     

    Add to ID

    If you want to add 1 to the last ID, use the add() function. A separate Compose action isn't necessary as you can combine the add() function into the expression in the Compose action above. I prefer to use separate Compose actions to keep my flow organized and easy to understand. 
    Run a test.
     

    Compose Unique File Name

    Use another Compose action to compose the file name. However, in your original screenshots you are hardcoding the file extension. You can dynamically set the file extension to avoid any issues. I cover how to do that in this tutorial:How to Get Microsoft Form File Uploads Attached to an Email 📧
     
     
    Hope this helps!

    Consider giving me a ❤️ if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram
     

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!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 286

#2
David_MA Profile Picture

David_MA 256 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard