Graphical User Interface to create automator packages

automator-logo

Business case:

Until now the only option to generate automator packages was to write code. The automator code is easy to learn and very efficient, meaning that with a couple of lines you can achieve great things.

However, some people don’t like to code. For that reason we created the graphical UI to create automator packages. We call it the automator-editor. In that early version the automator-editor generates the code for you.

automator-editor

Despite many pre-developed components like “send Mail” or “Custom Data” you need to know 2 things:

  1. What do I want to achieve?
  2. and a basic understanding of how algorythm work…

Conclusion

The techwork automator enables everybody with a basic knowledge to create automator packages for ITRP and soon for other applications with a REST API.

k.konwalin@techwork.at

 

Summary pdf for the accounting department

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

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 department *****/

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 department *****/

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

 

Mail interface to small external service providers 2

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:

Please find the full description of the business case in blog post “Mail interface to small external provider 1“.

In this post we provide an automator package to read the mail the service provider sends back and stores the information in the note field. What needs to be done?

Minimal requirements:

  • We need to look for the ITRP Request Number in the subject (Request # …)
  • We need to fetch the request in ITRP
  • If the request is there we need to look for custom data to apply the internal Service Instance, Team and Member, so that the request is back in the correct inbox.

 


log('******* Mail back from the external provider ********')

$subjectMatch = mail.subject~'Request #(\\d+)';
$itrpRequestNr = $subjectMatch[1];

if ($itrpRequestNr) {
  $request = fetch('requests', $itrpRequestNr);

  if ($request) {
    $teamID = $request.custom_data.wdc_team_id ? $request.custom_data.wdc_team_id : $WDC_Default_Team;
    $memberId = $request.custom_data.wdc_member_id ? $request.custom_data.wdc_member_id : '';
		$serviceInstanceID = $request.custom_data.wdc_si_id ? $request.custom_data.wdc_si_id : '';
    
    $bodyMatch = mail.text~'([^]*)Your original request description:';
    $providerText = $bodyMatch ? $bodyMatch[1] : mail.text;

    $date = date();
    $m = moment($date);
    $tz = $m.tz("Europe/Vienna");
    $tzDate = $tz.format("DD.MM.YYYY, HH:mm");

    update('requests', $itrpRequestNr, {
      team_id: $teamID,
      member_id: $memberId,
      service_instance_id: $serviceInstanceID,
      status: 'assigned',
      note: '```' + $tzDate + ' -- Email back from external provider```:\n\n' + $providerText;
    });
  }
}

log('******* Mail back from the external provider END ********')

 

What it does in human language:

Line 3 and 4: Looks into the subject line of the Email for “Request #” and stores all numbers (digits) after the # in variable “$itrpRequestNr”.

Line 6 and 7: If there is a number stored in $itrpRequestNr then it fetches the request into variable “$request”.

Line 9 to 12: If there is a request stored in “$request” we look in the custom data field for the team id, member id and service instance id and store them into variables.

Line 14 and 15: In the mail body everything above “Your original request description:” is stored in variable “$providerText”. The assumption is that the provider sends the original description at the end of the email. If the line can not be found the whole body content is stored in variable “$providerText”.

Line 17 to 22: Like I described in the last post is to get a valid timestamp for the note. Therefore it will be easy to read when the email came in from the external provider.

Line 24 to 30: It just updates the request with all the data mentioned.

Wrap up

This post and the last post explain how to build a cheap email based interface between ITRP and another Service Management tool. The whole interface takes 2 hours to set up in a live environment.

k.konwalin@techwork.at