I remember asking somewhere how this was done and did it in 1.5 but now I cant get it to work anymore in 5.1
I have the following code in a policy fired workflow (not a blocking task):
var notificationHelper = new VclNotificationHelper();
notificationHelper.setMessage(messageBody);
var entityLink = notificationHelper.getEntityLink();
var task = vcdHost.getEntityById(VclFinderType.TASK, entityLink.id);
var taskOwnerLink = notificationHelper.getTaskOwnerLink();
// Get Template Info
if (task != null) {
System.log("task not null. task.href : " + task.href);
var instantiateVAppParams = task.getParams(new VclInstantiateVAppParams());
var vAppTemplateReference = instantiateVAppParams.source;
vAppTemplate = vcdHost.getEntityByReference(VclEntityType.VAPP_TEMPLATE ,vAppTemplateReference);
var vAppTemplateParentVdcName = vAppTemplate.parent.name;
var vAppTemplateParentVdcId = vAppTemplate.parent.id;
}
It keeps erroring on this:
TypeError: Cannot read property "id" from null
it seems that the vAppTemplate object is no longer returned from the task.
Has something changed in 5.1 that no longer allows this?
The example "Approve Vapp (simple)" does the exact same thing with a blocking task.
Dion