cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
sakleboe
Level: Powered On

How to change item permissions *immediately* after a new SharePoint item is created?

Hello everyone,
I am working on a custom PowerApps form, that is based on a SharePoint list.
My requirenment is to set item permissions directly after a new item is created.

 

I try to accomplish that requirenment with a MS Flow.

If you have any other/better suggestion, I am open for your recomendations. :-)
If my approach seems to be constructive, please read my below problem description.

 

My first test was to work with the "When a item is created or modified" condition to start the flow.

The flow works fine, but I learned, that it takes a while untill the flow will start.
For this reason I implemented the PowerApps condition in my flow:

 

2019-01-03 17_05_43-Window.png

Inside my PowerApps form I start the flow inside the SharePointIntegration --> OnSave function, after the form is submitted:
2019-01-03 17_25_58-Window.png
My thinking was, that a item ID is available at this stage, but it seems not to be.

What do I have to change, to make my flow integration work?

Thanks a lot for your reply!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How to change item permissions *immediately* after a new SharePoint item is created?

Hi @sakleboe,

Based on the formula that you provided, I think there is something wrong with the place where you put your SupportTicketSaveFunction.Run() formula.

If you put your SupportTicketSaveFunction.Run() formula within the OnSave property of the SharePointIntegration control, it would cause an issue that -- the SupportTicketSaveFunction.Run() formula executed, but the corresponding record has not been saved into your SP list.

In addition, there is also something wrong with your SupportTicketSaveFunction.Run() formula. You could not get the the Item ID of submitted record using SharePointIntegration.Selected.ID formula. When you create a new record, the SharePointIntegration.Selected.ID formula would return empty.

As an alternative solution, please take a try with the following workaround:

  1. Remove the SupportTicketSaveFunction.Run() formula from the OnSave property of SharePointIntegration control.
  2. Add the following formula within the OnSuccess property of the SharePointForm1 control:
SupportTicketSaveFunction.Run(                    
Text(SharePointForm1.LastSubmit.ID), /* <- Modify formula here */
"01 - Inquiry",
"xxxxx@microsoft.com"
);
ResetForm(SharePointForm1);
RequestHide()

Note: The SharePointForm1 represents the Edit form control within your app.

 

Best regards,

Kris

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

Re: How to change item permissions *immediately* after a new SharePoint item is created?

Hi @sakleboe,

Based on the formula that you provided, I think there is something wrong with the place where you put your SupportTicketSaveFunction.Run() formula.

If you put your SupportTicketSaveFunction.Run() formula within the OnSave property of the SharePointIntegration control, it would cause an issue that -- the SupportTicketSaveFunction.Run() formula executed, but the corresponding record has not been saved into your SP list.

In addition, there is also something wrong with your SupportTicketSaveFunction.Run() formula. You could not get the the Item ID of submitted record using SharePointIntegration.Selected.ID formula. When you create a new record, the SharePointIntegration.Selected.ID formula would return empty.

As an alternative solution, please take a try with the following workaround:

  1. Remove the SupportTicketSaveFunction.Run() formula from the OnSave property of SharePointIntegration control.
  2. Add the following formula within the OnSuccess property of the SharePointForm1 control:
SupportTicketSaveFunction.Run(                    
Text(SharePointForm1.LastSubmit.ID), /* <- Modify formula here */
"01 - Inquiry",
"xxxxx@microsoft.com"
);
ResetForm(SharePointForm1);
RequestHide()

Note: The SharePointForm1 represents the Edit form control within your app.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
sakleboe
Level: Powered On

Re: How to change item permissions *immediately* after a new SharePoint item is created?

Hi Kris,

Thanks for your tip.

As beginner I thank I had a wrong understanding about the Event Lifecycle.

I just checked Google but I could not find any information.

Do you know a source where I get information, which event (like OnLoad) is executed at which time?

During my search I found a graphic for the ASPX Lifecycle. Is such a graphic available for PowerApps?

KR,

Sascha