0 votes

I have a custom command that prompts for a "reporter" for our ticketing system for enabling VPN accounts. Sometimes a technician will enable an account on behalf of another user who is owner of the system affected. The parameter "Reporter" is an AD object picker. I then have an Action to create a Jira ticket using Powershell with that parameter as reporter. It also sends e-mail notification (additional action) to the vendor, the reporter, and the IT team. The To: box contains %mail% for the vendor (action is performed on an account),; %param-Reporter%; IT@domain.com. The %param-Reporter% thows an error because it's not an email address. How do I extract the email address of that object chosen as a parameter? Thank you.

by (70 points)

1 Answer

0 votes
by (228k points)

Hello,

This can only be done by sending the email notification using a PowerShell script. To send email notifications in PowerShell scripts, use the $Context.SendMail method. To get the email address of the user specified in the Custom Command parameter, use the below code, where param-MyParameter is the name of the parameter with the param- prefix:

$user = $Context.BindToObjectByDN("%param-MyParameter%")

try
{
    $userEmail = $user.Get("mail")    
}
catch
{
    $Context.LogMessage("The user specified in parameter 'MyParameter' has no email address. ", "Information")    
} 

Should you have issues writing the script, we will help you.

Related questions

0 votes
1 answer

I am working on a script that sends an email (using Send-MailMessage) to one or more recipients, selected through an AD Object Picker parameter within a custom command. I have ... picker before running the code so I am confused as to why this is not working.

asked Mar 4 by ryan741 (120 points)
0 votes
1 answer

Hi, I am Create a Custom Command. The Parameters UI Control is AD object picker. The Action is add the Parameters in Extension Attribute 1 But it will add the AD DN. If I want to add LogonName, what parameters should I enter?

asked Aug 2, 2021 by will.chc.join (90 points)
0 votes
1 answer

We have an AD Atturbute called HRManager which refferances AD accounts (like the manager attubute does) is there a way to get the email address of the referanced account in a script?

asked Jun 7 by hgletifer (1.3k points)
0 votes
1 answer

Hello The search function in the AD object picker seems to be limited to the attribute "Name". I have some AD groups where the name is not very meaningful for our ... these cases. Is there any way to include the "Description" attribute in the search? Pudong

asked Sep 26, 2021 by pudong (580 points)
0 votes
1 answer

Hi I've added values to two attributes of an Oraganization Unit: adm-CustomAttributeText1 adm-CustomAttributeText2 I'm trying to extract these properties with a powershell ... But this does not provide the value set in adm-CustomAttributeText1. Any ideas?

asked Jan 28, 2013 by kjesoo (960 points)
2,807 questions
2,541 answers
6,615 comments
65,154 users