CMDB: Automate standby for continuity CIs

automator-logo

Prerequisites if you like to try it:

  • You already have an ITPR demo account. If not, you can easily request one with demo data.
  • You already signed up for a techwork automator demo account. If not, goto the registration blog post.

Business case:

Maintaining CIs accurately in the CMDB could be of vital importance if something goes wrong in order to get a Service Instance up and running again. For important CIs  you probably have standby CIs. Because of that ITRP provides the status “Standby for Continuity” and the relationship type “Continuity”.

Whenever an important CI changes the status from “In Production” to “Being Repaired” or a similar status the CMDB needs to be updated:

  • The linked CI with the relationship type “Continuity” needs to change the status from “Standby for Continuity” to “In Production”.
  • Other CIs and relationship types might also need updates.

To do this efficiently without too many manual steps we developed a 10 liner in the automator to do that.


mergeAudit(ci);

if (ci.audit_is_changed_status && (ci.audit_old_status == "in_production" && ci.audit_new_status == 'being_repaired')) {
    for($item of ci.ci_relations) {
        if ($item.relation_type == 'continuity' && $item.ci.status == 'standby_for_continuity') {
            update('cis', $item.ci.id, {
                status: 'in_production'
            });
        }
    }
}

The code with comments:

//get the audit for the updated ci
mergeAudit(ci);

//did the status change from "In production" to "Being repaired"
if (ci.audit_is_changed_status && (ci.audit_old_status == "in_production" && ci.audit_new_status == 'being_repaired')) {
    for($item of ci.ci_relations) {
        //change all linked items with the relationship type "Continuity" and the status "Standby for Continuity" to "In Production"
        if ($item.relation_type == 'continuity' && $item.ci.status == 'standby_for_continuity') {
            update('cis', $item.ci.id, {
                status: 'in_production'
            });
        }
    }
}

Conclusion

Such short scripts make it easier to keep the CMDB up to date because it reduces manual error-prone steps and make working with ITRP even easier.

k.konwalin@techwork.at

 

Advertisements

Summary pdf for the accounting department with the graphical editor

automator-logo

Prerequisites if you like to try it:

  • You already have an ITPR demo account. If not, you can easily request one with demo data.
  • You already signed up for a techwork automator demo account. If not, goto the registration blog post.

Business case:

In some organisations the accounting department needs a pdf file after an order has been executed. With ITRP this is easily achievable via an approval task because such tasks send a summary pdf file to the approvers.

However, there is no need for the accounting department to approve or reject something because the goal is simply to get the pdf file in an email – in that sense it is of course a workaround. To achieve this, the automator automatically completes the “Purchase – Order summary to accounting” task automatically, therefore no human interaction is required. In my example this is done via the user “Howard Tanner”. In a live environment we use an “Automation” user instead of “Howard Tanner”. Further we pretend that and “Chet Baker” works in accounting.

PO_summary2.png

The pdf file “Chet Baker” (accounting) gets

change_summary_pdf

NEW: The code generated with the automator-editor

Package_Editor_pdf_to_accounting

Generating the code with the graphical automator-editor consumes 3 minutes of clicking 🙂

The automator package to complete the task automatically

The package is executed whenever the task “Purchase – Order summary to accounting” changes from “Registered” to “Assigned”.

/***** Begin send pdf to the accounting deparment *****/

mergeAudit(task);

if (task.template.id == $Summary_pdf_to_Accounting &&
    		task.audit_is_changed_status && task.audit_new_status== 'assigned') {
    update('tasks', task.id,{
    	note: '``` Completed by automation - Summary pdf sent to Chet Baker ```',
    	status: 'approved'
    });
}

/***** END send pdf to the accounting deparment *****/

Note

This automation package takes 5 minutes to write. Without the automator nobody would probably automate this simple task. Some would probably choose to complete it manually or forward an approval email from someone else.

k.konwalin@techwork.at