Hi,
I'm working on a project, a part of this project is patch some fields then send emails to multiple recipients
this is a demo I'm trying to solve my issue on it
I'm working on SharePoint list, after submitting the form it should change the status to "Mail Sent" and field name "Sc1ModifiedBy" to insert the current Editor name but this is not happing exactly, the strange point after I submit the item number 5 the status and ScrNotificationTo patched in item number 3 !
the same thing after submitting item number 8 the item number 6 status and ScrNotificationTo are patched!
and this is the Gallery Screen
Screen 2 - the form
Button.OnSelect : Submit(Form)
Form.OnSucsess :
Patch( 'Demo - Collect', First( Filter( 'Demo - Collect', ID = GalleryMain.Selected.ID ) ), { Scr1ModifiedBy: CurrentUserName, Status: { '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference", Value: "Mail Sent", Id: GalleryMain.Selected.ID } } );//send email to Author Office365.SendEmail( "my-email@abcxyz.com"; GalleryMain.Selected.Author.Email; DCMgrNameDD.Selected.Email, "Your Request Sending mails now", "<p>Hi!</p> <p><br />Test Mail</p> <p><br /> <a href= 'www.abcxyz.com' target='_blank'>User ID Preferences</a></p>", {Cc: "my-email@abcxyz.com", IsHtml: true });RequestHide()
I'm receiving the email to my email "my-email@abcxyz.com" in To: and Cc: , but PA can't send emails to the other fields values: GalleryMain.Selected.Author.Email;
DCMgrNameDD.Selected.Email
I checked the values by inserting label and they are correct, but I don't know why PA can't send emails to them
also, the patching not working correctly!
Thanks
Dears, any suggestions?
Hi @ElMeSaFeR,
Do you custom a form for your SP list using PowerApps?
I have made a test on my side, and don't have the issue that you mentioned.
For your first issue, it seems to tell that there is something wrong with the Filter function within your Patch function that you provided.
Please take a try to modify your Patch function as below:
Patch( 'Demo - Collect', SharePointForm1.LastSubmit, /* <--- modify here */ { Sc1ModifiedBy:CurrentUserName, Status:{ '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference", Value: "Mail Sent",
Id: GalleryMain.Selected.ID } } )
Note: The SharePointForm1 represents the Edit form control within the Edit screen.
then check if the issue is solved.
For your second issue, I think there is something wrong with the Office365.SendEmail() function that you provided. Please modify your Office365.SendEmail() function as below:
Office365.SendEmail( "my-email@abcxyz.com"&";"& GalleryMain.Selected.Author.Email&";"& DCMgrNameDD.Selected.Email, "Your Request Sending mails now", "<p>Hi!</p> <p><br />Test Mail</p> <p><br /> <a href= 'www.abcxyz.com' target='_blank'>User ID Preferences</a></p>", {
Cc: "my-email@abcxyz.com", IsHtml: true }
)
then check if the issue is solved.
Best regards,
Kris
yes it's working fine now , many thanks
but do you think this code
SharePointForm1.LastSubmit,
is the best practice in this case ... what about if there's many users working and submitting the form in same time ?
Hi @ElMeSaFeR,
In order to avoid many users submitting the form, please take a try with the following workaround:
Set the OnSelect property of the "Submit" button to following formula:
Set(SubmittedItem,EditForm1.Updates);SubmitForm(EditForm1)
Note: The EditForm1 represents the Edit form control within your app.
Modify the Patch function within the OnSuccess property of the Edit form control as below:
Patch( 'Demo - Collect', SubmittedItem, /* <--- modify here */ { Sc1ModifiedBy:CurrentUserName, Status:{ '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference", Value: "Mail Sent",
Id: GalleryMain.Selected.ID } } )
Best regards,
Kris
Hi Kris,
Thanks so much, I think it will work .. I'll check it by tomorrow and will feedback to you
I'd like to ask about this code
First( Filter( 'Demo - Collect', ID = GalleryMain.Selected.ID ) )
why you advise me to delete it, or when I have to use it?
Regards;
sorry Kris it's not working
it's double the times - each time I submit the form it creating tow items in SP list - and the only 2nd item the values changes!
I check also
First( Filter( 'Demo - Collect', ID = GalleryMain.Selected.ID ) )
and
First( Filter( 'Demo - Collect', ID = SubmittedItem.ID ) )
and many tries but no luck
now my project is working fine with sending emails except changing some the values
I wish we can find a solution for this case soon
Regards
Hi @ElMeSaFeR,
I actually agree with @v-xida-msft post on Saturday. Were you able to try with those changes? I believe that would work well. Let me know if you received errors when you changed the formula patch in that way.
Thank you,
Audrie
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
219 | |
207 | |
85 | |
57 | |
36 |