cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Filistyn
Helper V
Helper V

sending email via sharepoint list

Hey! I have a sharepoint list

database123.png

 

NameOfEmployee is an employee's email address. If I work at Finance department, I want my manager to get an email everytime I have requested a day off. I have tried this:

 

Office365Outlook.SendEmail(LookUp(
        Employees,
        Department = varMyDept,
        Position = "Manager"
    ).NameOfEmployee ,"test", "test")

varMyDept is my department. It does not compile, can somebody help please?

1 ACCEPTED SOLUTION

Accepted Solutions

@Filistyn 

 

One more try with same formula 

	Office365Outlook.SendEmail(LookUp(
        Employees,
        Department= varMyDept && 
        Position = "Manager"
    ).NameOfEmployee ,"test", "test")

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

View solution in original post

9 REPLIES 9
zmansuri
Super User
Super User

If position and department is choice type field then you need to write

Department.Value

Position.Value

 

Another thing you can do is set the manager's email address in a variable on OnStart and reference that variable in outlook code

I can do that, but there are many departmens in our company, so I would have to set as many variables as there are managers, which I don't want to do since It's not effective.

You only need one variable that will save logged in user's manager's email.

Great idea, I have tried this 

Set(
    varManager,
    LookUp(
        Employees,
        Department = varMyDept,
        Position = "Manager"
    ).NameOfEmployee
)

Doesn't work

PG_WorXz10
Community Champion
Community Champion

Hi @Filistyn ,

Could you please try below formula. I assume you varDept will be having something like 'Finance' or 'CS & Logistic'.

 

	Office365Outlook.SendEmail(LookUp(
        Employees,
        Department.Value = varMyDept,
        Position = "Manager"
    ).NameOfEmployee ,"test", "test")

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

Doesn't work since department is Single line of text

@Filistyn 

 

One more try with same formula 

	Office365Outlook.SendEmail(LookUp(
        Employees,
        Department= varMyDept && 
        Position = "Manager"
    ).NameOfEmployee ,"test", "test")

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

check what value you are getting in varManager using label. if you are getting correct email id. Try adding that variable name in double quotes in outlook code

Works perfectly! Thank you very much sir!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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