[Solved] Custom Attribute for Service

automate

#1

I’ve seen in the API docs that I can assign custom attributes to VMs.

However, being and end user of a CF portal I’ve seen this is also possible for services, but not sure how:
cf_ca

This would be useful to store service-specific metadata.


#2

I’ve slightly modified the example in the book, assigned a button to the service and this worked fine:

#
# Description: add custom attribute to service
#
$evm.log(:info, "add_service_attribute started")
#
# Get the service object
#
service = $evm.root['service']
#
# Get the dialog values
#
key   = $evm.root['dialog_key']
value = $evm.root['dialog_value']
$evm.log(:info, "Key: #{key}, Value: #{value}")
#
# Set the custom attribute
#
service.custom_set(key, value)
exit MIQ_OK

service custom attribute