Hi All,
I have VRA 7.2 and want to enable custom email from VRO. Can someone please let me know the payload definition that i can get the VM owner email address. I am able to get the IP,VM name and resources but not able to get the email address.
Thanks
Parag
Here is the code that I am using to get the email address for the person that the workflow is requested_for
/*
- Retrieve the email address of a user principal
- Input: vCACCAFEHost [vCACCAFE:vCACHost]
- Input: principalId [String]
- Output: emailAddress [String]
*/
var emails = new Array();
var principalId = System.getContext().getParameter("__asd_requestedFor");
var vCACCAFEHost = Server.findAllForType("vCACCAFE:vCACHost")[0]
var tenant = vCACCAFEHost.tenant;
var authenticationClient = vCACCAFEHost.createAuthenticationClient();
var authenticationPrincipalService = authenticationClient.getAuthenticationPrincipalService();
try {
var principal = authenticationPrincipalService.getPrincipal(tenant,principalId);
//Principal is a vCACCAFEUser object
var emailAddress = principal.getEmailAddress();
return emailAddress
} catch (e) {
var emailAddress = "Could not find email";
return emailAddress
}
The email address isn't a property that's passed. The owner or requester is, and that property is __asd_requestedBy.
any idea which custom property will help me on VirtualMachine.Admin.AdministratorEmail on my VRA. Also Thanks for my other issue.
Thanks
parag
Here is the code that I am using to get the email address for the person that the workflow is requested_for
/*
- Retrieve the email address of a user principal
- Input: vCACCAFEHost [vCACCAFE:vCACHost]
- Input: principalId [String]
- Output: emailAddress [String]
*/
var emails = new Array();
var principalId = System.getContext().getParameter("__asd_requestedFor");
var vCACCAFEHost = Server.findAllForType("vCACCAFE:vCACHost")[0]
var tenant = vCACCAFEHost.tenant;
var authenticationClient = vCACCAFEHost.createAuthenticationClient();
var authenticationPrincipalService = authenticationClient.getAuthenticationPrincipalService();
try {
var principal = authenticationPrincipalService.getPrincipal(tenant,principalId);
//Principal is a vCACCAFEUser object
var emailAddress = principal.getEmailAddress();
return emailAddress
} catch (e) {
var emailAddress = "Could not find email";
return emailAddress
}
Thanks sbeaver, it works