Jump to content
Sign in to follow this  
Ben Simpson

Sending mail based on the user logged in

Recommended Posts

I'm using the send mail script step to send messages. I have some user accounts created where each user can only edit certain fields. When they are done I want them to click on a send e-mail button that I've created so that it sends a message to the next person in line. For sake of shortness, I'll just say the users are A, B, C, and D.

What I'm wondering is how do I write my script so that if account A is logged in and clicks the button, a message will be sent to C, but if B logs in and clicks the button it will send to D?

Share this post


Link to post
Share on other sites

If [ currentuser = A ]

Send Mail [ to: C ]

Else If [ current user = B ]

Send Mail [ to: d ]

End If

There are other ways* to do it, but this is the most explicit.

*The conditional could be in the To: calculation of the Send Mail script step, thus reducing it to one step.

Share this post


Link to post
Share on other sites

Will I need to set up a separate table that lists all the users and their e-mail addresses so that it will work? How do I go about setting it up so that it knows which account is logged in? Here's the thought that's currently running through my head:

If I set up a table that in one column lists the usernames and a second column that lists their corresponding e-mail addresses it would look like this for example, and call the table currentuser:

jdoe johndoe @123.com

doej janedoe @123.com

So when I set up the If statement you provided, is there something else I need to do so that (hopefully I word this right) when the script is ran it knows which account is logged in and uses the information from that table, or does it just do it automatically so that:

If (currentuser = jdoe)

Send Mail (to = doej)

What is happening at the moment is that since there currently isn't a table called currentuser, I end up receiving an error that the specified table couldn't be found.

Edited by Guest

Share this post


Link to post
Share on other sites

I got it to work. I ended up replacing the currentuser with Get(AccountName) and set it up so that

If[Get(AccountName)="A"]

Send Mail[To: "email address"

and so on and so forth, for the remaining accounts.

Thanks for your help.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.