cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
azeesdinu
Helper II
Helper II

People Picker with Global Variable

Hi,

I have custom list  with "Assigned To" column. I wanted to send email whenever add person to this field.  We cannot use the legacy Issue Tracking or Task list since I need PowerApps functionality in my custom list. 

 So I created "Assigned To" (People Picker field) custom filed and "Previous Assigned To Email" (string filed). 

I have to send the notification using flows whenever person is added/ replaced. 

 

Example -

When Person A added in “Assigned To” - Notification will go to Person A

When Person A  replaced by  To Person B in “Assigned To”. I have to send the notification both Person A and Person B. 

How can I hold the Previous "Assigned To" person email in in text box. 

 

Regards,

Abdul

 

 

 

9 REPLIES 9
jhall
Continued Contributor
Continued Contributor

When you issue an EditForm() on a record (assuming you're doing a model-app style form), you can follow that by assigning the current value of the field to a variable (e.g. Set(oldAssignedTo,AssignedTo.Text)).

If the value of OldAssignedTo <> AssignedTo.Text when you do a Submit then you need to send two alerts.

HI Jihal,

Thanks for your reply. I tried the same in my powerapps. I have used customise PowerApps screen from the custom list. 

in App OnSelect event I set the value to variable like 

Set(varAssignedTo, AssignedValueCard.Selected.Email) 

 

in "Previous Email"filed Default formula - I trying to get the value from the varAssignedTo like

If(varAssignedTo<>AssignedValueCard.Selected.Email, varAssignedTo, Parent.Default) 

 

But "Previous Email" field always return Empty. 

 

jhall
Continued Contributor
Continued Contributor


@azeesdinu wrote:

in App OnSelect event I set the value to variable like 


Sorry to be nitpicky, but do you mean App | On Start (meaning when the app begins) or are you firing this during an "OnSelect" event somewhere along the chain?

The key is, the specific record in question must be loaded into the Form before you try to do this.  So doing it at App | OnStart would fail (be blank) or trying to do it tied to an OnSelect on any button/field before the Form is populated would as well.

Hi,

I got it why it's empty now. I dont use the custom submit button on the form.I have used OOTB save button in the list. How can I capture the old value and compare it with updated value. 

jhall
Continued Contributor
Continued Contributor

Let's try a screen shot or two.  Can you walk me through it w/ a couple of images?  That might help us both.

Hi @azeesdinu ,

Could you please share a bit more about your scenario?

Do you create a custom form using PowerApps for your SP List?

Further, do you want to capture the value within the "Previous Assigned To Email" column in your SP List when you edit an existing record using the custom form?

 

Actually, when you add a Person within the "Assigned To" field first time, and click the "Save" button to submit your form data, you should also update the email value of selected Person in the "Assigned To" field into the "Previous Assigned To Email" column in your SP List.

On your side, please set the OnSuccess property of the SharePointForm1 (Edit form) to following:

Patch(                        /* <-- Add formula here. Use Patch function to update the email value of selected Person in the "Assigned To" field into the "Previous Assigned To Email" column */
         'YourSPList',
          SharePointForm1.LastSubmit,
          {
            'Previous Assigned To Email': SharePointForm1.LastSubmit.'Assigned To'.Email
          }
);
ResetForm(SharePointForm1);
RequestHide()

 

If you want to capture the value within the "Previous Assigned To Email" column in your SP List when you edit an existing record using the custom form, please take a try with the following formula:

SharePointIntegration.Selected.'Previous Assigned To Email'

If you want to compare the old "Previous Assigned To Email" column value with updated value Assigned To column value, please use the following formula:

If(
   AssignedValueCard.Selected.Email <> SharePointIntegration.Selected.'Previous Assigned To Email',
...,
... )

 

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

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.

Hi 

Yes, I'm using "Customize Forms" options in the custom list PowerApps. 

 

 

 

 

 

Hi v-xida-msft,

jhall
Continued Contributor
Continued Contributor

You've got your Default setting for the PreAssignedToUserEmail field tied to an If() that is checking to see if it is different from the original email. 

image.pngIf it differs, then you're changing the Default to be what's contained in this field to be the value of the AssignedToValue field (which I'm assuming is the new person).  So it appears you're blowing away your Previous email the moment you make any change to the AssignedToValue dropdown.  

 

Also, if the PreAssignedToUserEmail field is linked to the same Form in SharePoint, then I don't believe there's a need for the Patch (it gets Submitted w/ everything else).  

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,064)