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 / Create multiple items ...
Power Automate
Unanswered

Create multiple items in Sharepoint list based on number of occurrences in calendar

(2) ShareShare
ReportReport
Posted on by 62

Hi all,

 

I have a PowerApps with calendar event entry, one feature is user can decide if the event is recurrent and how many times the occurrences is.

 

For example, they created an event and they want this event to be recurrent on monthly basis for 12 occurrences.

So I need to save this event 12 times with same information (i.e location, required attendees) but different dates.

 

I am making a flow to save these occurrences in SharePoint list but I am already stuck on how to loop it. I already have for one time entry but how can I do this multiple times.

 

PowerPlatform_Calendar.jpg

 

Any help is appreciated. Thank you!

 

 

Regards,

May

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    Community Power Platform Member Profile Picture
    on at

    Hello!

     

    I believe I found a solution for your problem. To start, I defined 2 variables: the number_ocurrences (will be set with the number of dates you wanna create) and the counter (will increment the initial date ).

     

    As a condition, sharepoint items will be created until the counter is equal to the number_ocurrences variable. To achieve this condition, everytime that a sharepoint item is created the counter should be incremented by one.

     

    To create the sharepoint item with the correct date, the following expression was used:

     

    addToTime(utcNow(),variables('counter'),'Month','yyyy-MM-dd')

     

    This expression will add to the 'utcNow' (that in your case should be the initial date) and will add the value defined in the 'counter' variable to the Months.

    I believe this logic will solve your problem.

    Bellow you can see a print of my flow.

     

    timoreira_0-1635853036436.png

     

    Any question that you have feel free to ask.

     

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

  • mayarnaldo15 Profile Picture
    62 on at

    Hi @Anonymous ,

     

    Thank you so much! 

    I can understand the concept now. However, I run an error. Maybe you can take a look at it?

     

    I have to use Switch because I have a choice column in the SP on the recurrences: Daily, Weekly, Month, Yearly. 

     

    But when I am trying to save it, here's an error on template validation on the default trigger. Do you know how to solve this? Thank you again!

     

     

    Error.jpgerror1.jpg

     

     

     

    Regards,

    M

  • Community Power Platform Member Profile Picture
    on at

    Hello!

     

    I'm glad you understood the logic behind my previous answer! Regarding this new issue, I will present bellow some troubleshooting steps to better understand where is the problem.

    1. Can you please delete the trigger action "When a file is created" and add the "Site Address" and "List Name" using the dropdown option? Sometimes wrong url's can cause problems in these kind of triggers.
    2. Have you used any additional trigger conditions in the action "When a file is created" behind the "Site Address" and the "List Name"? Just to be sure that the problem is not from something not visible in the flow. To check if no extra condition is selected, you can follow the instructions bellow, where your selections should be like the ones shown in the pictures.

     

    timoreira_0-1635950172957.pngtimoreira_1-1635950211421.png

     

     

    If the suggestion from point 1 doesn't solve the issue, and the answer to point 2 is no, I have another suggestion for you. To discover where is the problem in the flow, can you run the flow step by step, adding each action at the time and saving the flow at each step? In this way we will be able to know the action that is causing the problem.


    Any question that you have feel free to ask.

     

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

     

  • mayarnaldo15 Profile Picture
    62 on at

    Hi again,

     

    I already solved the other errors but I noticed the date output. The first date (incremented) is the same as the original date. The original entry is Testing the Date output - 11/14/2021. It should be repeated 3 times. The next date should be 11/15/2021 then 11/16/2021 then 11/17/2021.

     

    date_incremented.jpg

    I am using this on the date

    addToTime(triggerOutputs()?['body/Date'],variables('counter'),'Day','yyyy-MM-dd')

     

    Thank you for your time! 🙂

     

    Regards,

    May

     

  • Community Power Platform Member Profile Picture
    on at

    Hello again 🙂 

     

    I believe the problem is in the increment of the variable 'counter'. Can you please confirm that you are using the action "Increment variable" (see printscreen below) after the "Create Item" action, and you are incrementing the counter?

     

    timoreira_0-1636632868138.png

     

    Look forward to your reply.

     

  • mayarnaldo15 Profile Picture
    62 on at

    Hi,

     

    Yes. I am using the increment 🙂

    do until.jpg

     

    /M

  • Community Power Platform Member Profile Picture
    on at

    Hello!

    Can you please confirm me if the same error occurs both on 'Daily' and 'Weekly' options?

     

    Look forward to your reply.

  • mayarnaldo15 Profile Picture
    62 on at

    Hi again,

     

    I tested Monthly, Weekly and Yearly.

    Testing Daily.jpg

    I think the dates are off but this might be because if its 30 or 31 days in a month.

     

    Thank you so much!

     

     

    Regards,

    May

  • Community Power Platform Member Profile Picture
    on at

    Hello again.

    To avoid the problem of the different days of a month, you can take advantage of the third parameter of the addToTime function.

     

    Bellow, where you have [unit], you can input any of the following options:

    Second, Minute, Hour, Day, Week, Month or Year (don't forget to include '')

     

     

    addToTime(triggerOutputs()?['body/Date'],variables('counter'),[unit],'yyyy-MM-dd')

     

     

    So, accordingly with the previous printscreen that you sent, what is incorrect? Just to clarify the problem, because from what I see it is adding days, weeks and years to the original date ('Testing').

    Look forward to your reply.

     

  • mayarnaldo15 Profile Picture
    62 on at

    Hi,

     

    Yes, I tried that code 🙂

    addToTime(triggerOutputs()?['body/Date'],variables('counter'),'Day','yyyy-MM-dd')
    addToTime(triggerOutputs()?['body/Date'],variables('counter'),'Month','yyyy-MM-dd')
    addToTime(triggerOutputs()?['body/Date'],variables('counter'),'Week','yyyy-MM-dd')
    addToTime(triggerOutputs()?['body/Date'],variables('counter'),'Year','yyyy-MM-dd')

     

    But the date output is off by 1 day for Weekly, Monthly and Yearly.

    Testing Daily_01.jpg

     

    And for Daily. The first output date (incremented) is same as original date.

    date_incremented_01.jpg

     

     

    Any idea, why this is happening? Thank you again! 🙂

     

    Regards,

    May

     

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