Showing posts sorted by relevance for query script step. Sort by date Show all posts
Showing posts sorted by relevance for query script step. Sort by date Show all posts

Utilization of programming knowledge

"Script Step" is a kind of "automated Step" within a Business Process.

These are Steps for automatically executing "program processing", such as, for example;
  • with reference to "attendance time" and "leaving time" entered in the upstream process,
  • automatically calculates "working time" ({leaving time} - {attendance time}).
Conversely, if you incorporated such a Script Step into the Daily report flow, employees do not have to fill in "hours worked " each time.

What can be done?

Automatic processing performed on the Workflow platform is so-called "Server side processing".

In other words, when an Issue flowing through a Business Process reaches the "Script step", data are automatically referenced and updated. All processing is executed while human beings are not aware or concerned.

The program code to be set there will be a configuration like;
  • starting with "to reference business data",
  • via "various arithmetic processing",
  • end with "updating business data".

What kinds of "operations" are possible?

For example, in the case of "Questetra BPM Suite" which is a cloud based Workflow product, it is given the specification as "(*) capable of setting Server-side JavaScript (ECMA Script)". And the following operations are available.
  • Basic numerical data operation (four arithmetic operations, square root, exponent, round-off, random number...)
  • Basic character string data manipulation (join, split, reshape, extract, replace, search ...)
  • Basic date and time data operation (addition, subtraction, progress calculation, day of week judgement, Japanese calendar conversion ...)
  • Generation and analysis of JSON data
  • Generation and analysis of XML data
  • Sending HTTP request (data GET, data POST, OAuth2 communication, Basic authentication ...)
  • Send SMTP request (send email, attachment file generation, convert character code ...)
* You can also use Java methods that can be handled by the Rhino engine, and Questetra extension methods. [R2300]
※ The details are HERE and THERE.

[Hours-worked report-Hours and minutes]

  • A) A document before translation
  • B) A document after translation
Want to record the "number of characters" of these automatically.

If "a human is required to count the number of characters", you will never implement this operation. However, if "a Workflow system would tell the number automatically", you might think of leaving it as a record...


In "Questetra BPM Suite", a Cloud-based Workflow, you can easily add automatic processing of the following, since Auto-step icons have been incorporated in it in advance.
  • To combine string A and string B (M227)
  • To Sum numeric A and numeric B (M227)
  • To generate a PDF by embedding strings into Template PDF (M228)
  • To store files at Google Drive (M229)

However, in order to automate an operation like this example of "Count the number of characters", you were required to place a versatile automated Step referred to as [Script Task] (Script Step) (M230), and to set Scripts (ECMA-Script/JavaScript) as its property. (As of Ver. 11.0)

[Translation Process-Characters Counter]
Processing a particular "Business data"
Converting a particular "Business data"
Retrieving the number of characters as a property of a particular "Business data"

Basically, a "Workflow system" automates "transactions" of Business data. I want to automate not only "transactions", but also "Tasks themselves" as far as possible.(To be unmanned) Especially, for "Mechanical routine"...

In "Questetra BPM Suite", a Cloud-based Workflow, using a feature of Auto-Step which has equipped originally, it is capable of server side processing, such as
  • To combine String A and String B (M227)
  • To sum Numeric A and Numeric B (M227)
  • To generate PDF file embedding strings to a Template PDF (M228)
  • To back up files tin Google Drive (M229)

However, it won't do for a "Processing that is more unique" even a little bit.

The "Character number counter" in the following Workflow is an automated Step that is, for example, to count the number of characters in String type data of X which has been entered at upstream Step, and to store the number into a Numeric type data item. (All done on the Server side) For such a case, you need to place a versatile Step which is referred to as [Script Step] (Script Task: M230), and to set a Script (ECMA-Script/JavaScript) into it. (as of version 11.0)

[Character Number Counter]
In the article before the last, "Episode 518: What is Automation of Business Process (Part 1)", I mentioned about two aspects regarding automation of Business Process, such as;
  • [A] Automation of handing over of Issue information between Processes
  • [B] Automation of processing in certain Step

Also, in the last article, "Episode 519: What is Automation of Business Process (Part 2)", I mentioned about the scope and implementation method of "[A] Automation of handing over".

In this article, I would like to organize the range to which "[B] Automation of processing" can be applied and the implementation method.



What kind of "processing" can be automated

Complete automation (Auto-Step)

Likewise the idea of "[A] Automation of handing over" is that leaving the delivery of Issue information from a certain Step to the next one to a computer, it leaves the "work inside certain Step" to the computer in "[B] Automation of processing".

Even in "Quote Creation and Approval" which is a Business Process with a high degree of human dependence, for example, it is possible to leave processing in Steps to the computer, such as
  • creating Quote PDF file,
  • sending email with file attachment,
  • posting summary of the Quote to Enterprise social network.

* Incidentally, it may be easy to understand with an expression that (instead of using the term of 'automation') "part of Step of Business Process to be unmanned", as long as it is not necessary to contrast with "[A] Automation of handing over."


Partial automation

On the other hand, there are some Steps that not to be automated completely.

For example, in the Step of "Creating a Quotation" in "Quote Creation and Approval" Business Process, supporting function such as
  • Calculate total amount
  • Calculate consumption tax amount
would contribute to labor saving of work. However, in this case, the Step of "Creating the Quote" is not unmanned, as some human input (human interface) is necessary. Therefore, it can be said that such Steps should be classified as "human Step".

[Quote Creation and Approval]

Japanese calendar text

There are many cases in Japan that use "Japanese calendar" instead of "Western (Gregorian) calendar".

This year is "2017" as well as "Heisei 29".

In other words, there are many cases where Date type data such as "2017-03-13" should be displayed as "March 13, Heisei 29" in prints and email texts. In the article (*) about one year ago, I introduced you the Japanese calendar conversion using the [Script Task], the automatic step. (Automatic conversion of Issue data flowing in the Cloud-based Workflow "Questetra BPM Suite")

Episode 467: Certificate Issue Date on Auto-generated PDF in Japanese Era Name (2016-01-25)

Script step and Service step

However, as of version 11.1 or later (2016-09-05) of the Cloud-based Workflow "Questetra BPM Suite", it is possible to add arbitrary [Service step] by "Service definition file" (add-on XML).

That is, if you use [Service step] which performs Japanese calendar conversion, you do not need to use [Script step] (which requires programming knowledge).

[Certificate Issuance-Japanese Calendar]

It is no longer an uncommon that letting a Workflow system processing, such as;
  • "Auto-calculation" for consumption tax",
  • "Auto-generation" of invoice PDF,
as the sophistication of information system progresses.

You can reduce mistakes and reworkings greatly by automation of intermediate steps. And also it leads to a shortening the required time for the entire process.

However, on the other hand, excessive automation will result incomprehensible of the mechanism, and become incapable of corresponding upon occurrence of troubles.

All the more reason, when it includes auto-steps which error occurrence rate is not negligible, such as
  • "Auto data retrieving" using communication network
  • "Auto data storage" using communication network
  • "Script Step" with lots of if statement
  • "Script Step" including decimal calculation
(Actually, it might be a great agenda in "era of utilizing Cloud.)

[Invoice Issuance-Sampling check]

  • Instruction manual sentences that described in multiple language
  • Manuscripts of Website (HTML)
  • Source codes

A Creation flow for these drafts ought to be devised to record (not only "Number of characters", also) "Hash value" automatically.

A Hash value is a "Message digest". It is also referred to as "fingerprint". In short, it generates "32 of hexadecimal characters" (in the case of MD5 method) from any data instantly, allowing to validate data falsification of even a single character. (For more details, please see Wikipedia, etc.)

In the following workflow, [Auto-steps](Service Task) of "Hash generation (MD5)" and "Hash generation (SHA256)" have been arranged. Both of them will be available when you conduct feature expansion with [Addon XML]. (Questetra BPM Suite v11.1. Releasing in early September?)

[Translation Process-Hash Value]
I definitely want an Auto-step icon that is needed in this business!

Everybody who designs Business Processes (Modeling) tends to desire to automate various processing.

In version 11.1 of Cloud-based Workflow, "Questetra BPM Suite", which we are going to release at the end of August 2016, you will be able to use additional Auto-step icons. More specifically, your original auto-step icons will be available by; obtaining packaged "Add-on XML" and importing it as Additional feature file (Process Model file).

You will get these [Add-on XML] mostly by
  • Downloading from Questetra's Website
  • Provision from third-party

Whereas, it will be also capable of creating yourself, as you can guess from the words of "Add-on XML".

The following is the same "Translation Process" workflow that I have introduced you in the last post. And in which I made a substitution to [Script Step] with self-made [Auto-Step].

[Translation Process-Add-on]

Automation with server side JavaScript

In the last article (*), I mentioned that "automatic Step of Questetra BPM Suite can implement (not only simple numerical calculation) OAuth2 communication".
* Episode 524: Automation of Work with Server-side JavaScript

Therefore, in this article, I would like to briefly summarize about "what kind of external service is specifically possible with OAuth2 communication" and "what kind of programming is required specifically". (In the viewpoint of requesting from the workflow system side.)

What is OAuth2 communication

OAuth is a "scheme for authorizing requests to servers".

Reference) What is "OAuth", the Cloud Technology which Everyone should Know?

Since OAuth2 first appeared in 2012, APIs of many "resource servers", such as Google Drive and Dropbox, are now compatible with "OAuth2 access". That is, the external system can throw various "Reference request" and "Update request" to "resource server". (RFC6749/6750)

In the cloud-based Workflow "Questetra BPM Suite", it is possible for an automatic Step placed in a business process definition to behave as an "external system" (OAuth2 client). In other words, you can set so that the following requests are automatically executed each time an Issue reaches the automatic Step (Script Task / Service Task).

  • Script Task: a Step in which a Business designer can set server-side JavaScript (Communication using HttpClientWrapper can also be implemented) M230
  • Service Task (Addon): Step which packaged Script Task. Only configure setting is allowed for Business designer. M415 M416
Reference)


How to get access token

"Access token" is required for such request communication.

"Access token" is "a proof that it is a request authorized by the owner of the resource", and the entity is a string of from about several tens to 200 characters. However, the access token acquisition method differs depending on "resource server".

As main method, there are
  • A. Let the owner click on "grant button" and then automatically obtain. (Authorization Code Grant)
  • B. Set secret credentials, then retrieve automatically (Client Credentials Grant)
  • C. Set the access token itself (e.g. when an Access Token without expiration date is possible)

However, it varies depending on the type or characteristic of data managed by "resource server".

Caution) Even with the OAuth 2 authorization method that the destination API can implement, there might be cases where automatic communication can not be set depending on implementation restrictions (Questetra side) regarding "HTTP header" and "Content - Type format".

[Invoice Submission]
I introduced a fully automated Workflow that is

> to update the Workflow platform common "Client Master" by receiving JSON response from kintone API,

in the last post.

In this post, I would like to introduce how to

> Update the "Client Master" in kintone by sending JSON data to kintone API.

More specifically, it is a mechanism that suppliers (customer code and customer name) is added to the "customer master" on the kintone, upon the moment when a start of trading in the "Credit Management Workflow" has been approved.

After all, it is configured that JSON string such as

{
  "app": "3",
  "record": {
    "customerCode": {
      "value": "9999999999999#www.example.com"
    },
    "customerName": {
      "value": "XYZ Inc"
    }
  }
}

POSTed to kintone API at the downstream of the Workflow.

* JSON: JavaScript Object Notation (Mass of data in which the pair of "key" and "value" have been enumerated)

[Credit Management]
Requesting an answer (0-100) about the "Project progress" to four people at the most.

For staffs of the Internal Audit department who conduct investigation all over every week, they would think 'I wish at least the calculations for "the average value of progress" to be automated'.

In the following Workflow, a mechanism (Script Step) of auto-calculation of 'the average' upon the completion of answering by the Rapporteurs (1-4 people), is devised. (Moreover, it is equipped with an automatic sending of email addressed to the concerning officers when the progression average was more than 90%.)

The "Automation of In-house situation awareness" like this would also contribute to the strengthening of the quality control system, not only to the operational efficiency. (for the Contracting business, the Construction business, etc.)

[Progress Report Process Auto-calculation]
The last time, I published a case of cooperation with "Corporate Identification Number System" (Web-API).

◇2015-12-07: Brush-up on Customer Master Data by "Corporate Identification Number System Web-API"

This Business Process is a mechanism to automatically check if "the Names of Businesses in connection have changed" or not every week. It is automatically started at six o'clock in every Sunday morning. Human beings can detect naturally something to be corrected has occurred in "Customer Master (XML)".

However, it is on the assumption that "all the company has a Corporate Number". That is, it makes inquiry about all the companies listed one by one toward the "Web-API system". In reality, there exist trade partners who do not have Corporate Number. (Sole traders, foreign companies, etc.)

In the following Business Process Definition, it tolerate the presence of dummy number of "9999999999999" (13-digit 9) in the "Customer Master".

That is, it is the rule that to register "13-digit 9" for the business partners like overseas clients that do not have a Corporate Number. In addition, it is devised to make request for 10 instances at one time, toward "Web-API system".

[Automatic check of Trade-name Registration in Customer Master #2]

There, it will come one more month later...

The Individual Number system will start also here in Japan. (2015-10-05) In this blog as well, I have exemplified several Workflows (Business Process) about "Process of Individual Number collection".

And I am going to introduce examples of utilizing "Corporation Number" also in the following weeks. Also,I am planning to publish utilization examples of "Web-API function" of Corporate Number system sequentially as soon as I confirm operation on "Pre-verification environment".

In this article, I will summarize on "Error detection" which is indispensable in the business that deal with "Individual Number".

The Workflow definition below is a sample which allows you to experience 'accuracy check' on input data. It is set both of [1] the mechanism of automatic data checking during input (JavaScript in input screen), and [2] the mechanism of data checking on the server computer (JavaScript in Script Step)

By the way, "Check Digit" means a character for inspection. It is used widely for such as "Credit card number", "Product code"(EAN / JAN barcode), "International Standard Book Number" (ISBN), etc. In the case of "Individual Number" in Japan,
  • Corporation Number (13 digits): The leftmost digit
  • Individual Number (12 digits): The rightmost digit
are calculated by the "specific formula", and is added.

[Check Digit sample:"Test form" screen]

Want to automate "Prorated billing".

Rent, Water charge, Cloud service... In any field, "invoicing process" is a very important business. No mistake is allowed. Even though a human would do the credit investigation and address input, I want to let a computer do the calculation of "prorating".
  • Indeed, a computer is a machine.
  • It makes no mistake.
  • And it is fast.
But on the other hand, it also has stupidity such as, one third multiplied by three equals "0.999". There is not much difference about this aspect between a calculator and a supercomputer. (Oh, I hear voices of objection from users of J programming language, etc.)


In the following Workflow, prorating calculation for "a service which monthly fee is 10,000 JPY" is automated.

It is a simple sample flow that, inputting information of "used X days in month MM of year YYYY", then automated until "generating of invoice PDF".

In this example, as obvious on the flow chart, even an "Approval Step" or a "Send-back Step" is not arranged for the sake of simplicity. A very plane Business Process. Therefore, it is useful as a base for the development of applied system, such as "printing out automatically" or "automatically transmit email with attachment".

[Invoice Issuance flow]

"It's so troublesome to enter billing data..."

Logs such as bank deposits and withdrawals and card payments have become "automatic journalizing", and "accounting input work" became quite easier compared to before.

However, in terms of "sales" in particular, it is too late to wait for the timing of "deposit". After all, it is desirable to record it as "sales as accounts receivable" at the time of "invoice" issuance... Rather, it's a must.
  • 2016 - 11 - 22: Accounts receivable 120,000 / Sales 120,000 = Website creation (for company A)
  • 2016 - 12 - 31: Saving deposit 120,000 / Accounts receivable 120,000 = Website creation (for company A)

Incidentally, on the contrary, there are cases where cannot include in "sales" at the time of issuing "Invoice" (even at the time of "deposit").
  • 2016 - 12 - 31: Saving deposit 120,000 / Advance received 120,000 = Maintenance 2017 - 01 - 2017 - 12 (for Company A)
  • 2017-01-01: Advance received 10,000 / sales 10,000 = 2017-01 of Maintenance 2017-01 to 2017-12 (for company A)
  • 2017-02-01: Advance received 10,000 / sales 10,000 = 2017-02 of Maintenance 2017-01 to 2017-12 (for company A)
  • 2017-03-01: Advance received 10,000 / sales 10,000 = 2017-03 of Maintenance 2017-01 to 2017-12 (for company A)
  • 2017-04-01: Advance received 10,000 / sales 10,000 = 2017-04 of Maintenance 2017-01 to 2017-12 (for company A)
  • 2017-05-01: Advance received 10,000 / sales 10,000 = 2017-05 of Maintenance 2017-01 to 2017-12 (for company A)
  • 2017-06-01: Advance received 10,000 / sales 10,000 = 2017-06 of Maintenance 2017-01 to 2017-12 (for company A)
  • 2017-07-01: Advance received 10,000 / sales 10,000 = 2017-07 of Maintenance 2017-01 to 2017-12 (for company A)
  • 2017-08-01: Advance received 10,000 / sales 10,000 = 2017-08 of Maintenance 2017-01 to 2017-12 (for company A)
  • 2017-09-01: Advance received 10,000 / sales 10,000 = 2017-09 of Maintenance 2017-01 to 2017-12 (for company A)
  • 2017-10-01: Advance received 10,000 / sales 10,000 = 2017-10 of Maintenance 2017-01 to 2017-12 (for company A)
  • 2017-11-01: Advance received 10,000 / sales 10,000 = 2017-11 of Maintenance 2017-01 to 2017-12 (for company A)
  • 2017-12-01: Advance received 10,000 / sales 10,000 = 2017-12 of Maintenance 2017-01 to 2017-12 (for company A)

The creation method and creation timing of so-called "transfer slips" (transfer records) varies depending not only on the type of industry but also on company policy. Even so, the work itself should certainly be "automated".

In the following Workflow, at the moment when the "Invoice" is approved by the supervisor,
  • Receipt PDF will be emailed to he customer,
  • Multiple line "transfer records" are automatically calculated
  • The import file is automatically generated.

Accounting staff can finish "input work" by only uploading the automatically generated Excel-CSV file to the accounting system.

[Invoice Issuance flow]

Automation of billing

It will be very convenient if you can control "PayPal" as a billing system from the workflow system "Questetra".

For example, if you create a mechanism that automatically issues a "PayPal invoice according to delivery details" immediately after "product delivery flow" is completed, it is possible to prevent the occurrence of "billing mistake" or "billing omission". If the current situation is a billing operation that mails a "paper invoice", it is also possible to reduce all stamp fee, printing fee and office work labor costs to zero.

In the previous article, I introduced you mechanisms that automatically instructs PayPal "to generate invoices in PayPal" and "to send the invoice generated in PayPal further to customers".

Further automation

If you could automate
  • letting PayPal generate a "PayPal Invoice", and
  • letting PayPal send a "PayPal Invoice" via email,

I would like to further automate
  • confirming payment to PayPal. (Improve efficiency of debt collection business)

In this article, we will consider assembling the automatic Steps cleverly and making the "payment check flow" unmanned.

* Here, programming knowledge is required since we are going to use "Script Task" which is a type of automatic Step

[Entry reception system-PayPal billing-Payment confirmation]

'Date in Japanese calendar!'

"Representation of years" is complicated in Japan. That is, We do not say "year 2016" at the governmental procedure or at schools. This year is absolutely "Heisei 27". The date is represented in "Japanese calendar" in documents which have a little bit of importance, such as "Residence certificate", "Family registration", or "Graduation diploma"...

However, in reality,,, only a few Japanese can immediately answer that "this year is Heisei 28!"

Even so, this "mechanism of resetting to the first year (year 1), once in several decades" is continued already 1400 years or more. It is too much significant for the government of the time to abolish... (And, on the day the current emperor died, another new "era name" will be published.)


The following is a flow of "Employment certification" issuance.

It has devised that at an upstream Step, the employee's 'name' and "birth date' are entered, and the a certificate PDF is automatically generated at [Auto-step] in the middle of the flow. Notably, date data such as "date of birth" and "certificate issue date" is automatically converted to the Japanese calendar. It could be diverted also to issuance flow for, for example, "Graduation certificate" or "PTA News", etc.

[Certificate Issuance]

"Monthly settlement confirmation, oh, bother..."

Trouble concerning settlement would never end. Even though 'Online banking' has become convenient, still it takes some sort of effort.

Furthermore, work of "dunning" occurs if "unpaid" occurred. This is not just 'laborious'(increase of steps), it will be a burden to mental health for both the debtor and the creditor. Why can't it be "electronic settlement" furthermore?


The following Business Process Definition is a Workflow of credit card settlement on "monthly tuition for piano lesson".

In this example, 'fee according to the number of lessons' (instead of 'fixed monthly tuition') will be charged at the end of months. It is like, for example, 2000JPY for the month in which two lessons have given, 5000 JPY for five lessons. (We use "Stripe" for online settlement.)

When you realize electronic settlement for lesson fees with this Workflow, you will no longer have to hand-deliver the "invoice" to your students. For the parents of the student, they will not need to go to the bank to make a remittance of the lesson fee every month.

By the way, "Questetra BPM Suite", a Cloud-based Workflow, is free of charge for a use by 'less than ten staffs'. However, you should be careful that the service will be stopped if an interval of logins exceeds 15 days. But that won't be a problem, as long as you login after each lesson to write "date of lesson" (information for charging).

[Lesson Fee Credit Charge]

Measuring working time on certain process

For example, when you want to measure the "time required for translation" in the translation process, you can consider a method that having "reporting (inputting)" actual working time" together with the"translation result".

However, in that method, it requires to have the workers to measure the actual work time in the means such as;
Such an act of "self-measuring and reporting working hours" must be a major effort.

* However, there are still advantages that it is possible to respond flexibly, such as temporarily stopping the measurement, when time to be excluded such as "coffee break" or "corresponding to interrupt work " occurs halfway.

The accuracy of the reported value

Also, "Inaccurate actual work time" may be reported as a result.

For example, the "work time" would be entered a little differently from the fact, if it is a system in which some incentive affects to make the "translation time" looks shorter (or longer) in terms of personnel evaluation and ability assessment.

Alternatively, if there are workers who are proud of their outcome of the work itself and have no interest in such as "translation time", we have to assume that 'perfunctory data' will be entered.

[Translation flow]

Day-to-day work is full of Team passwords...

When you install a wifi router, you configure "Admin password". When you apply for online printing service, you register a "Business account". When you just buy a scanner, you are demanded "User registration". Despite I have grown up having been taught "Never share your password" since my childhood, there are lots of passwords that are inevitable to share in the real adult life! (And, top secret files are stored in the file server of the company...)


The following Workflow is a Business Process for managing "Team password".

You may regard it as a "Password manager" of an organization. It is devised to disclose a password after ten minutes when an employee makes a request. All the information, such as When it was used, Who used it, and Which password, will be recorded. (Moreover, "Password change" by the administrator will be recorded, as well.)

[Password Request]