VMware Cloud Community
pedjono
Enthusiast
Enthusiast
Jump to solution

vRA/vRO 7.5 - vRO action not working with input on vRA Custom Form

Hi all,

I am integrating with "Jira API's" I am using the vRO REST plugin.

All works well to do a GET or even a POST for JIRA Issues.

When I put my vRO action on a workflow to do a GET and return the string "Valid Jira Story" if the Issue number exists, it works with the 'userIssue' as an INPUT parameter, and RESTOperation set.
pastedImage_0.png

So whats the problem you ask?
When I add the action to a Custom Form, I have the RESTOperation set for the GET,  and have a text field setup for the input parameter 'userIssue" but it fails, with the Error:

pastedImage_0.png

The script is:

pastedImage_3.png

Any help is appreciated thanks.

Reply
0 Kudos
1 Solution

Accepted Solutions
xian_
Expert
Expert
Jump to solution

The error log says your input restOp was null. But you cannot select your RESTOperation in the custom form as an input. So I suggest to remove it from the inputs and search for the operation within the action itself:

var restHosts = RESTHostManager.getHosts();

var restHost;

var restOp;

for each (hostID in restHosts) {

  var host = RESTHostManager.getHost(hostID);

  if (host.name == "jira") {

    restHost = host;

    break;

  }

}

var ops = restHost.getOperations();

for each (opID in ops) {

  var op = restHost.getOperation(opID);

  if (op.name == "myOp") {

    restOp = op;

    break

  }

}

Another method is to hard-code the IDs instead of the names.

View solution in original post

Reply
0 Kudos
2 Replies
xian_
Expert
Expert
Jump to solution

The error log says your input restOp was null. But you cannot select your RESTOperation in the custom form as an input. So I suggest to remove it from the inputs and search for the operation within the action itself:

var restHosts = RESTHostManager.getHosts();

var restHost;

var restOp;

for each (hostID in restHosts) {

  var host = RESTHostManager.getHost(hostID);

  if (host.name == "jira") {

    restHost = host;

    break;

  }

}

var ops = restHost.getOperations();

for each (opID in ops) {

  var op = restHost.getOperation(opID);

  if (op.name == "myOp") {

    restOp = op;

    break

  }

}

Another method is to hard-code the IDs instead of the names.

Reply
0 Kudos
pedjono
Enthusiast
Enthusiast
Jump to solution

Thanks
Your answer gave me enough to get this working.

I have also removed the "userIssue" param on the restoperation, and instead set the urlTemplate in the code with the input param instead as per below, this stops the action failing while the input is null.

restOp.urlTemplate = "/rest/api/2/issue/"+userIssue

Thanks again

Jono.

Reply
0 Kudos