cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Cath_Tatham
Frequent Visitor

Using ClearCollect and Set Functions for Contact Owners and Mail Sends

Hi there,

 

I am building a mobile app for contacts (Advisors) to interact with our team members (Users/ Owner). 

 

The Advisors are marked as Users when logging in to the mobile app, so I have used a Look Up Function to access their information from the Contact Entity as per below.

 

ClearCollect(CurrentUser, (LookUp(Contacts, Email = CurrentUserEmail)))

 

This is working fine and I have had no issues with this.

 

One of features of the mobile app lets the Advisor email the Owner assigned to them. I have used the below function to launch the mail application, but the email address populates with CurrentUserOwner.internalemailaddress rather than the actual email address.

 

Launch("mailto:" & "CurrentUserOwner.internalemailaddress")

 

So I have tried to use another Look Up and ClearCollect Function to look up the details of the Owner, and Set Functions to set the OwnerID and OwnerEmail but have had no success as the lower two Set Functions give me red lines under "systemuserid" and "internalemailaddress" (schema names).

Set(CurrentUserOwner,First(CurrentUser.Owner));
ClearCollect(CurrentOwner, (LookUp(Users, User = CurrentUserOwner)));
Set(CurrentOwnerID,CurrentUserOwner.systemuserid);
Set(CurrentOwnerEmail, CurrentUserOwner.internalemailaddress); 

 

If there's an easier way to launch the mail without using the second ClearCollect and Look Up functions I'm happy to try it!

 

Please can someone help me out?

Thanks!

5 REPLIES 5
iAm_ManCat
Super User
Super User

Hi @Cath_Tatham 

 

Maybe not the most elegant way of doing it but this should work:

 

Launch( First( Concatenate( "mailto://", CurrentUserOwner.internalemailaddress ) ).Result )

 

We are concatenating the two values together, which makes a table of values, then getting the first row, then getting the result of that... then we launch it - I have tested it now with a few different user details.

 

Let me know if this works for you,

 

Kind Regards,

Sancho

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Hey,

 

I have tried your suggestion and I get an error for the whole command.

 

The logic makes sense, I just don't understand why it's not working.

 

Thanks.

 

Cath

Hey @Cath_Tatham 

 

Thanks for getting back to me - ok, so let's take a look at why it's giving an error:

 

If we work our way from inner-most to outside we can see that concatenate has invalid arguments (which is probably then causing errors with the other parts) - there are only two parts to this concatenate so there must be something wrong with CurrentUserOwner.internalemailaddress - if we hover over that specific part of the formula we should see more details as to why - this is important to note for future troubleshooting as it will help you a lot in figuring out issues - when you hover over different parts of the formula you will see different messages.

 

Could you hover over CurrentUserOwner.internalemailaddress and see what it says? I suspect something like "expects text value" or something about 'Table value'

 

Thanks,

Sancho

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Hey,

 

Please see the error messages below.

 

Error Message 2.png

 

I think the bigger issue is perhaps the look up function which creates CurrentUserOwner? I am currently getting Invalid Argument Type error.

Invalid Argument Type Error.png

Kind regards,

Cath 

Ok, so it looks like CurrentUserOwner is fine, but CurrentOwner can't be set as its not finding the User with that lookup so we need to figure out the structure for CurrentUserOwner

 

If you go to View > Variables,

image.png

Then click on CurrentUserOwner it should provide you some more details as to the structure of the variable, which will help us determine why its not working within the Launch command - paste it back here and we can work from there 😺

 

Thanks,

Sancho

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (5,633)