VMware Cloud Community
PowerPaul201110
Enthusiast
Enthusiast

Get recurrence-pattern and recurrence-cycle of scheduled tasks

Hi there,

I am trying to fetch all scheduled tasks of vCO inside of a Scriptable Task like this:

var tasks = Server.findAllForType('Task'); 

for each (var t in tasks) { 

  // print information

  // ...

In addition I need information about the schedule (i.e. recurrence-pattern and the recurrence-cycle).

However, I can't find these information as attributes of the Task object:

task.png

Is there any way to achieve this?

thanks in advance

Paul

2 Replies
iiliev
VMware Employee
VMware Employee

Hi Paul,

Not all task parameters are exposed to scripting, so you cannot fetch recurrence pattern/cycle directly from variable 't' in you code snippet.

One possible workaround would be to fetch task ID (t.id) and then, using vRO database plug-in, fetch all the information for the task with this ID by executing SQL query on the underlying vRO database (table VMO_Task). A bit ugly hack, but in theory should work.

PowerPaul201110
Enthusiast
Enthusiast

Hi Ilian,

thanks for your answer. To bad that this is not exposed to scripting. As I figured out the two needed values are accessible through the REST API of vCO.
So I registered a new REST host pointing to itself. In addition I created a new REST Operation that fetches the needed information from https://vcohost:8281/vco/api/tasks/{id}.

As well, this breaks a fly on the wheel but it works as a second workaround.

Paul