cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Setayesh2
Helper I
Helper I

Search a record from another list

Hi,

 

Would someone please help?

I'm trying to make a purchase form. I made 2 SharePoint lists. One keeps approvers/Managers for each Affiliate. The affiliate column is Text and Approvers are Person type.

Setayesh2_1-1601971613827.png

 

The second list is the Purchase list. and I need to get managers from the first list based on affiliate.

Setayesh2_0-1601971576968.png

 

 

I try to get the first user's manager like: Office365Users.Manager(Office365Users.MyProfile().UserPrincipalName) or Office365Users.Manager(User().Email)

That doesn't work. I want to set it as DefaulSelectedItems for 'Approval Manager'

Then I want to use the first list to find the other managers and set them as DefaulSelectedItems for 'Approval by CEO'. If it was blank, then the user should add it manually. I tried
Screen - OnVisible : Set(Affi,Office365Users.MyProfile().Country)
DefaulSelectedItems : LookUp('Affiliate Order Approvers',Affiliate=Affi,'Approver 2')
But it doesn't work again.

 

Would someone advise?

Regards

 

1 ACCEPTED SOLUTION

Accepted Solutions

@Setayesh2 

I'm not entirely sure of your logic for each list.  But, as you say, they are all People columns.

 

So to set a DefaultSelectedItems property of a ComboBox that is based on a Person column to be a person retrieved from ActiveDirectory, you will need to implement this in your DefaultSelectedItems property formula:

With({profile:Office365Users.ManagerV2(User().Email)},
    {Claims: "i:0#.f|membership|" & profile.mail, 
     Department: profile.department, 
     DisplayName: profile.displayName,
     Email: profile.mail,
     JobTitle: profile.jobTitle,
     Picture: "."
    }
)

This will match a SharePoint person column signature and will have all the relevant information from the ActiveDirectory lookup.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

6 REPLIES 6
RandyHayes
Super User III
Super User III

@Setayesh2 

For ComboBoxes, you must match the records of the Items EXACTLY in the DefaultSelectedItems.  So the question would be, what is your Items property on these controls?

If it is based off of a SharePoint Person Column (i.e. Choices(yourList.yourColumn) ) then it will be a record in a SharePoint person format.  If it is Office365 based, then it will have a record signature of Office 365.  They are NOT the same structure and they will never match for DefaultSelectedItems.  So you have to match the record.

 

If you can provide more detail on the Items property of the ComboBoxes and details on the column types of the columns in SharePoint, that would assist more.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Hi @RandyHayes 

 

Yes, all approvers are based on SharePoint Person Columns.  The first approver's default value should be the user's Manager (that is set in AD). The other approver's name should search from another list. If the user's country = Affiliate column in the 2nd list then take the approver column value. all are Sharepoint person columns.

 

Screenshot 2020-10-06 191354.jpg

Thanks in advance

 

@Setayesh2 

I'm not entirely sure of your logic for each list.  But, as you say, they are all People columns.

 

So to set a DefaultSelectedItems property of a ComboBox that is based on a Person column to be a person retrieved from ActiveDirectory, you will need to implement this in your DefaultSelectedItems property formula:

With({profile:Office365Users.ManagerV2(User().Email)},
    {Claims: "i:0#.f|membership|" & profile.mail, 
     Department: profile.department, 
     DisplayName: profile.displayName,
     Email: profile.mail,
     JobTitle: profile.jobTitle,
     Picture: "."
    }
)

This will match a SharePoint person column signature and will have all the relevant information from the ActiveDirectory lookup.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

Thanks, @RandyHayes 

The idea for the second list is to save the approval[2,3] manager's name for each country(Affiliate). They are not the user's manager, so I cannot get them from AD. its because each manager can approve a limited amount of purchase.

I tried to use

DefaultSelectedItems :  If(IsBlank(LookUp('Affiliate Order Approvers',Affiliate=Office365Users.UserProfile(User().Email).Country,Approver_x0020_2)),Parent.Default,LookUp('Affiliate Order Approvers',Affiliate=Office365Users.UserProfile(User().Email).Country,Approver_x0020_2))

 

but it doesn't work. Would you please advise?

Regards

@Setayesh2 

Sorry for my delay in response on this.  Are you still struggling with the issue or have you resolved it?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

@RandyHayes 

Thanks for asking, It works. Part of the problem was the permission issue. I tried with the admin account and worked.

 

Regards,

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (1,906)