How To: Update a cmdb_ci_vm_instance record post-Cloud Provisioning using PoliciesIssue <!-- div.margin{ padding: 10px 40px 40px 30px; } table.tocTable{ border: 1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); padding-top: .6em; padding-bottom: .6em; padding-left: .9em; padding-right: .6em; } table.noteTable{ border:1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); width: 100%; border-spacing:2; } table.internaltable { white-space:nowrap; text-align:left; border-width: 1px; border-collapse: collapse; font-size:14px; width: 85%; } table.internaltable th { border-width: 1px; padding: 5px; border-style: solid; border-color: rgb(245, 245, 245); background-color: rgb(245, 245, 245); } table.internaltable td { border-width: 1px; padding: 5px; border-style: solid; border-color: #E0E0E0; color: #000000; } .title { color: #D1232B; font-weight:normal; font-size:28px; } h1{ color: #D1232B; font-weight:normal; font-size:21px; margin-bottom:-5px } h2{ color: #646464; font-weight:bold; font-size:18px; } h3{ color: #000000; font-weight:BOLD; font-size:16px; text-decoration:underline; } h4{ color: #646464; font-weight:BOLD; font-size:15px; text-decoration:; } h5{ color: #000000; font-weight:BOLD; font-size:13px; text-decoration:; } h6{ color: #000000; font-weight:BOLD; font-size:14px; text-decoration:; } ul{ list-style: disc outside none; margin-left: 0; } li { padding-left: 1em; } --> Description Post-provisioning it may be desirable for to update/modify VM instance (or other) records with custom information as it relates to your business needs. While it may be obvious to create Business Rules for this, it's not immediately clear what to do if information is needed from the Catalog Item when provisioning the cloud resources. One use case for this would be to assign ownership of a VM to the user group responsible for provisioning it. Solution We can accomplish this using a Cloud Policy. This is easier on London+ due to the "on Catalog item request end" Policy Trigger, which we'll use for this example. The initial steps are to do the following (assuming a basic familiarity with Cloud Policies, see Docs otherwise): Create new PolicySet trigger "on Catalog item request end"Set Blueprint as desired blueprintSet Operation as "Provision" Note that if you want this to work on all Blueprints, you leave Blueprint empty. But this means you cannot select the "Provision" operation. Additional code will be required in the Policy Action Script to filter so you aren't executing on other catalog item operations Create new policy rule to execute a scriptCreate new Policy Action Script (then set Policy Rule to execute script)Now modify the script. When writing a Cloud Policy there are two pertinent variables available to us: "formData" and "current". The formData object contains the data passed from the Blueprint during provisioning and the current object contains the data from the RITM record. The crux of it can be seen here, but basically clients will need to use either formData or information from the current object to make GlideRecord calls to the records they want to call and then make the desired updates/modifications:gs.info("formData: " + JSON.stringify(formData));gs.info("current: " + JSON.stringify(current));var vmGr = new GlideRecord("cmdb_ci_vm_instance");vmGr.addQuery("name","=",formData.Virtual_Server_NodeName);vmGr.query();if (vmGr.next())gs.info("vmGr: " + vmGr.sys_id);else gs.info("VM record not created at this time: " + new GlideDateTime().getLocalTime()); Applicable Versions All CMPv2 (easier in London+ due to "on Catalog item request end" option)