VMware Cloud Community
balawiz
Enthusiast
Enthusiast

How to get request ID of failed catalog requests?

I am using the following code to get the request ID on post blueprint catalog request completed event subscription and it's working fine when catalog request completes successfully. However, if it fails, it was not able to get the request ID. The input parameters are payload and vCACCAFE:VCACHost(vRA/vRO 7.2) and please help.

function getRequestId(deploymentId, vCACHost) {

var requestId = getRequestIdFromDeploymentId(deploymentId);

System.log('Request ID: ' + requestId);

return requestId;

}

function getRequestIdFromDeploymentId(deploymentId) {

var items = vCACCAFEEntitiesFinder.getCatalogResources(vCACHost);

for each(item in items) {

if (item.providerBinding.bindingId == deploymentId) {

return item.requestId;

}

}

throw 'Could not get request ID.';

}

var deploymentId = payload.get('deploymentId');

var catReqId = getRequestId(deploymentId, vCACHost);

Another method which I have tried below, but no success for failed catalog requests

var catRequestId = System.getContext().getParameter("__asd_catalogRequestId");

System.log(catRequestId);

var req = vCACCAFEEntitiesFinder.getCatalogItemRequest(vCACHost,catRequestId);

var catReqId = req.id;

System.log(catReqId);

Tags (2)
Reply
0 Kudos
1 Reply
balawiz
Enthusiast
Enthusiast

How to match the pre-approval payload any of property into the post completion (failed catalog requests) payload (or do we have to use any other input parameter to match?) property including __asd properties.  I am scratching my head to find out a way Smiley Sad. Please note that I am able to match for successful catalog deployment as previously mentioned.

pre-approval payload properties:

{sourceInfo={externalClassId=request, externalInstanceId=85ce722e-********, serviceId=***********3e2ca}, fieldNames={businessJustification=string}, requestInfo={requestedFor=name@domain.com, reason=fail check, approvalLevelName=Test_approval, requestedBy=name@domain.com, itemName=catalogName, requestRef=123456, approvalRequestId=ac10db17-******, description= fail check, subtenantId=92c2bd1a-*********, itemDescription=testCatalog, approvalLevel={classId=ApprovalLevel, id=fc31caae-*******************, label=Test_approval, type=entityReference}, createDate=date}}

Failed Payload properties:

{taskType=PROVISION, subtenant=92c2bd1a-********, completionDetails=The following component requests failed: some failed reason...

....

...

requestId=c25eef16-2*********, success=false, deploymentId=68238be4-************, blueprintId=test, tenant=testTenent, requestStatus=FAILED}

'__asd_requestInstanceId'

'__asd_catalogRequestId'

'__asd_targetResourceId'

'__asd_correlationId'

'__asd_requestTraceId'

'__asd_requestTraceId'

Reply
0 Kudos