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

Patching list items of behave of users who has access to the app

Hello everyone

 

I'm creating an App where by users will be added to the list and there's another list where every user needs to fill in what they have done Mon-Friday, this is done every friday so friday is the end of the week.

 

The idea is that users when they open the app, they will see a screen with the date of the friday(Week Ending) date and what the have to do is fill in what they did, problems they have faced and all that. So, how can i "pre-patch" the date for all the users so that when they get to the app, they just fill in what needs to be filled without having to first create a record?, Is the an API of some sort that can be used/called to get this done?

 

We don't users to have a button that they can click to create a record for then. In the list every user must see only records that are created by them.

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @Naphtaly,

Based on the issue that you mentioned, do you want to pre-create records for the login users to fill in during this week?

Could you please share a bit more about the scenario?

Firstly you should check if the date when the users fill in is Friday, if so, they could fill in directly, otherwise, you should assign a Friday date to the date column in your SP list.

I have a test on my side, please take a try as below.

In my scenario, I have a Title(Text) column to store the user name, a Date and time column(Only Date) store the date, a Comment(Text) column to store the comment

1). Set the OnStart property of the App as below:

Patch(
    DefaultSelectedItem,
    Defaults(DefaultSelectedItem),
    {
        Title: User().FullName,
        InterviewDateAndTime: If(
            Weekday(
                Today(),
                StartOfWeek.Monday
            ) = 5,
            Today(),
            DateAdd(
                Today(),
                5 - Weekday(
                    Today(),
                    StartOfWeek.Monday
                )
            )
        )
    }
)

Every time when a user login in, it will auto-create a record for this user.

2). Then you could add a Gallery and set the Items property as below:

Filter(DefaultSelectedItem,User().FullName)

3). Add an Edit form and set the Item property as below:

Gallery.Selected

Set the DataSource property as your own SP list.

4). Set the OnSelect property of the Gallery as below:

Navigate(EditForm1, ScreenTransition.None)

5). Add a submit button and set OnSelect:

SubmitForm(EditForm1)

 Please check if the above could help.

Regards,

Qi

Best Regards,
Qi

View solution in original post

2 REPLIES 2
C-Papa
Super User
Super User

can you use this in the default date field so it always shows Friday. then you do not need to create an entry, every entry will be Friday by default. you might need to play around with the numbers depending on the start of the week. 

 

Text(DateAdd(Now(),Switch(Weekday(Now()),1,5,2,4,3,3,4,2,5,1,6,0,7,7)),"dd mmm yyyy")

v-qiaqi-msft
Community Support
Community Support

Hi @Naphtaly,

Based on the issue that you mentioned, do you want to pre-create records for the login users to fill in during this week?

Could you please share a bit more about the scenario?

Firstly you should check if the date when the users fill in is Friday, if so, they could fill in directly, otherwise, you should assign a Friday date to the date column in your SP list.

I have a test on my side, please take a try as below.

In my scenario, I have a Title(Text) column to store the user name, a Date and time column(Only Date) store the date, a Comment(Text) column to store the comment

1). Set the OnStart property of the App as below:

Patch(
    DefaultSelectedItem,
    Defaults(DefaultSelectedItem),
    {
        Title: User().FullName,
        InterviewDateAndTime: If(
            Weekday(
                Today(),
                StartOfWeek.Monday
            ) = 5,
            Today(),
            DateAdd(
                Today(),
                5 - Weekday(
                    Today(),
                    StartOfWeek.Monday
                )
            )
        )
    }
)

Every time when a user login in, it will auto-create a record for this user.

2). Then you could add a Gallery and set the Items property as below:

Filter(DefaultSelectedItem,User().FullName)

3). Add an Edit form and set the Item property as below:

Gallery.Selected

Set the DataSource property as your own SP list.

4). Set the OnSelect property of the Gallery as below:

Navigate(EditForm1, ScreenTransition.None)

5). Add a submit button and set OnSelect:

SubmitForm(EditForm1)

 Please check if the above could help.

Regards,

Qi

Best Regards,
Qi

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,909)