VMware Cloud Community
sbeaver
Leadership
Leadership

Property Definitions External Script Action

I have an action that works perfectly when I run it from vCO but when I add it to the property definition and apply it to the blueprint I am getting an empty dropdown and then if I let the dropdown close and try to reopen I get the never ending hourglass.

What I am trying to do is populate the drop down with a list of Service Now groups that the logged on user is a member of.

Here is part of my code  Let me know if you see anything.  Again it works from inside vRO but not getting any values from vRA

var restOperation = Server.findForType("REST:RESTOperation","d4ab560b-1bb3-47e9-85de-d39b213464d3:9b6c7195-6a6e-4a4a-a428-63ed10aa67a0")

var actionResult = Server.getCurrentLdapUser()

var userID = actionResult.loginName.split("@")[0];

var inParamtersValues = [];

var request = restOperation.createRequest(inParamtersValues, null);

var response = request.execute();

statusCode = response.statusCode;

statusCodeAttribute = statusCode;

contentLength = response.contentLength;

headers = response.getAllHeaders();

contentAsString = response.contentAsString;

var groupProps = new Array();

var groupObj = JSON.parse(contentAsString)

  for each (var i in groupObj.result){

       for (var ii in i){

           if (ii == "group.name"){var grpName = i[ii]};

           if (ii == "group.sys_id"){var grpSys = i[ii]};

           .push(grpName)

       }

  }

return groupProps

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
0 Kudos
1 Reply
sbeaver
Leadership
Leadership

ok so I can answer my own question here.  The current LDAP user is not going to work here because a local cafe helper account is the LDAP account that connects.  To get the information I needed this was the call

var userID= System.getContext().getParameter("__asd_requestedFor");

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
0 Kudos