Reference service request ID from retirement automation


#1

I am working on a callback method to an external (service now) which is initiating service actions via api. On provisioning I access the following:

service = $evm.root.attributes[“service_template_provision_task”]
$evm.log(“info”, “+++3CBdestination_id: #{service.destination_id}”) <<< new service instance id
$evm.log(“info”, “+++3CBmiq_request_id: #{service.miq_request_id}”) <<< service request id

When retiring a service I need to supply the service request id to the callback. I’m not sure how to retrieve that from the database? Any directory would be appreciated. Thanks!


#2

I figured this out. I’ll share here in case anyone runs into the same issue.

set request variable with service_order_id

request = $evm.vmdb(‘miq_request’).where(:id => $evm.root[‘service_id’]).first.service_order_id


#3

Awesome! Thanks for sharing.