Hi all,
I hope you can help me out. This has been driving me crazy!
I have a SharePoint list form which I've customised in PowerApps.
I have a choice field called Status with the following values:
New
Awaiting Approval
Approved
Provisioned
I have a button that checks the status and submits the form. e.g.
If(Status_DataCardValue.Selected.Value = "New",
Notify("A notification has been sent to " & Manager_DataCardValue.Selected.DisplayName & ".");
SubmitForm(SharePointForm1),
If(Status_DataCardValue.Selected.Value = "Awaiting Approval",
...))
In the OnSuccess event I check the value of the LastSubmit value of the Status and perform various actions, such as send an email and patch the Status field to its next value.
If(
SharePointForm1.LastSubmit.Status.Value = "New",
Office365Outlook.SendEmailV2(SharePointForm1.LastSubmit.Manager.Email,
"User Onboarding: Approval Request for " & SharePointForm1.LastSubmit.'Display Name',
"<p>Dear " & SharePointForm1.LastSubmit.Manager.'Display Name' & ",</p>" &
"<p>Please click the link below to view and approve the onboarding of this user.</p>" &
"<p>Link to item: <a href=""" & Left(SharePointForm1.LastSubmit.'{Link}',Find("_layouts",SharePointForm1.LastSubmit.'{Link}')-1) & SharePointForm1.LastSubmit.'{Path}' & "EditForm.aspx?ID=" & SharePointForm1.LastSubmit.ID & """>View in SharePoint</a></p>"...;
Patch(
'User Onboarding',
{ID: SharePointForm1.LastSubmit.ID},
{Status:{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value:"Awaiting Approval"
}
}
),...
Everything works flawlessly except with the NewForm. The email that is received contains the correct Link to the Item (i.e. Link, Path and ID) but all the other LastSubmit.Column values are from another form -- even if I delete all previous records!
I don't understand how some values can be correct (the ID) but the others reference a different list item. All subsequent form submissions from the EditForm work as expected. It's almost like there's a delay with new items whereby the ID is immediately available but the complete record is yet to be available.
Solved! Go to Solution.
Hi @Panoone ,
Here is a workaround that save the last submitted record to variable upon the last submit ID at first, and then replace the SharePointForm1.LastSubmit.ColumnName by Variablename.ColumNname to reference other values.
Set(varRecord, LookUp('SP list',ID=SharePointForm1.LastSubmit.ID));
If(
VarRecord.Status.Value = "New",
Office365Outlook.SendEmailV2(VarRecord.Manager.Email,
"User Onboarding: Approval Request for " & VarRecord.'Display Name',
"<p>Dear " & VarRecord.Manager.'Display Name' & ",</p>" &
"<p>Please click the link below to view and approve the onboarding of this user.</p>" &
"<p>Link to item: <a href=""" & Left(VarRecord.'{Link}',Find("_layouts",VarRecord.'{Link}')-1) & VarRecord.'{Path}' & "EditForm.aspx?ID=" & VarRecord.ID & """>View in SharePoint</a></p>"...;
Patch(
'User Onboarding',
{ID: VarRecord.ID},
{Status:{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value:"Awaiting Approval"
}
}
),...
Hope this helps.
Sik
Hi @Panoone ,
Here is a workaround that save the last submitted record to variable upon the last submit ID at first, and then replace the SharePointForm1.LastSubmit.ColumnName by Variablename.ColumNname to reference other values.
Set(varRecord, LookUp('SP list',ID=SharePointForm1.LastSubmit.ID));
If(
VarRecord.Status.Value = "New",
Office365Outlook.SendEmailV2(VarRecord.Manager.Email,
"User Onboarding: Approval Request for " & VarRecord.'Display Name',
"<p>Dear " & VarRecord.Manager.'Display Name' & ",</p>" &
"<p>Please click the link below to view and approve the onboarding of this user.</p>" &
"<p>Link to item: <a href=""" & Left(VarRecord.'{Link}',Find("_layouts",VarRecord.'{Link}')-1) & VarRecord.'{Path}' & "EditForm.aspx?ID=" & VarRecord.ID & """>View in SharePoint</a></p>"...;
Patch(
'User Onboarding',
{ID: VarRecord.ID},
{Status:{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value:"Awaiting Approval"
}
}
),...
Hope this helps.
Sik
Thanks @v-siky-msft . That's the path I ended up taking and seems much more reliable, especially in the presence of patches occurring.
User | Count |
---|---|
253 | |
106 | |
94 | |
50 | |
39 |