cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rodrkayl
Helper I
Helper I

Permission to edit form based on user and title

Hi,

I have an application with multiple SharePoint lists used as data connections. I have a home page, with each SharePoint list given its own screen housing both the gallery and the detail set. My country-specific users will not be submitting new forms, but will be editing existing forms. How can I set it up so that each user can only see and edit form entries that correspond to their country? For reference, the 'Country' field is also the Title of each form entry. I basically want to set up a connection between the user and the country, so that the user can only see entries for their country. 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @rodrkayl :

Are you stuck on how to get the country of the user?

If so,there are two solutions:

1\Based on the location of the user's current device

 

Set(
UserCountry,
BingMaps.GetLocationByPoint(Location.Latitude,Location.Longitude).address.countryRegion
)

 

In this way,you need to add a BingMaps connection.

vbofengmsft_0-1634882336812.png

 

2\Based on the user's profile

 

Set(
UserCountry,
Office365Users.UserProfileV2(User().Email).country
)

 

 In this way,you need to add a Office 365 Users connection.

vbofengmsft_1-1634882357958.png

You could chose one of these formulas into the app's OnStart property to save the user's country into a variable named "UserCountry" when the app is loading.

Best Regards,

Bof

 

Best Regards,

Bof

View solution in original post

2 REPLIES 2
StalinPonnusamy
Community Champion
Community Champion

Hi @rodrkayl 

 

Set the items property of the Gallery to

 

With(
    {
        _User: User(),
        _source: [@'SPListName']
    },
    SortByColumns(
        Filter(
            _source,
            Title = First(Office365Users.SearchUser({searchTerm: _User.Email}).Country).Country
        ),
        "Title",
        If(
            SortDescending1,
            Descending,
            Ascending
        )
    )
)

 

 

Note: We can set the variable to get User information. Set OnStart property of the App to

Set(CurrentUser, User())

 

So that we can use CurrentUser all over the application.


Thanks,
Stalin - Learn To Illuminate

v-bofeng-msft
Community Support
Community Support

Hi @rodrkayl :

Are you stuck on how to get the country of the user?

If so,there are two solutions:

1\Based on the location of the user's current device

 

Set(
UserCountry,
BingMaps.GetLocationByPoint(Location.Latitude,Location.Longitude).address.countryRegion
)

 

In this way,you need to add a BingMaps connection.

vbofengmsft_0-1634882336812.png

 

2\Based on the user's profile

 

Set(
UserCountry,
Office365Users.UserProfileV2(User().Email).country
)

 

 In this way,you need to add a Office 365 Users connection.

vbofengmsft_1-1634882357958.png

You could chose one of these formulas into the app's OnStart property to save the user's country into a variable named "UserCountry" when the app is loading.

Best Regards,

Bof

 

Best Regards,

Bof

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,563)