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

Patching then send multiple emails

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! 

 

Patch-Emails1.png

 

and this is the Gallery Screen

 

Patch-Emails2.png

Screen 2 - the form

Button.OnSelect : Submit(Form) 

 

Patch-Emails3.PNG

 

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 

13 REPLIES 13
ElMeSaFeR
Level: Powered On

Re: Patching then send multiple emails

 
ElMeSaFeR
Level: Powered On

Re: Patching then send multiple emails

Dears, any suggestions? 

Community Support Team
Community Support Team

Re: Patching then send multiple emails

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

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.
ElMeSaFeR
Level: Powered On

Re: Patching then send multiple emails

@v-xida-msft

 

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 ?

Community Support Team
Community Support Team

Re: Patching then send multiple emails

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

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.
ElMeSaFeR
Level: Powered On

Re: Patching then send multiple emails

@v-xida-msft

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;

ElMeSaFeR
Level: Powered On

Re: Patching then send multiple emails

@v-xida-msft

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

Administrator
Administrator

Re: Patching then send multiple emails

@ElMeSaFeR We will esclate this for you, @Audrie-MSFT

Flow Staff Audrie-MSFT
Flow Staff

Re: Patching then send multiple emails

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

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 291 members 1,958 guests
Please welcome our newest community members: