<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gregorius Adrian Ekaprana on Medium]]></title>
        <description><![CDATA[Stories by Gregorius Adrian Ekaprana on Medium]]></description>
        <link>https://medium.com/@gregorius.adrian1994?source=rss-c3c7dff61ca0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*eEBrUKov6RNYL5S6.jpg</url>
            <title>Stories by Gregorius Adrian Ekaprana on Medium</title>
            <link>https://medium.com/@gregorius.adrian1994?source=rss-c3c7dff61ca0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 00:01:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gregorius.adrian1994/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[IBM Business Automation Workflow Using DateTimePicker in Tables]]></title>
            <link>https://medium.com/ibm-business-automation-ap-el/ibm-business-automation-workflow-using-datetimepicker-in-tables-19b4253a549b?source=rss-c3c7dff61ca0------2</link>
            <guid isPermaLink="false">https://medium.com/p/19b4253a549b</guid>
            <category><![CDATA[baw]]></category>
            <category><![CDATA[mpb]]></category>
            <category><![CDATA[workflow]]></category>
            <category><![CDATA[tips-and-tricks]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Gregorius Adrian Ekaprana]]></dc:creator>
            <pubDate>Tue, 19 May 2020 09:01:01 GMT</pubDate>
            <atom:updated>2020-05-19T09:01:01.442Z</atom:updated>
            <content:encoded><![CDATA[<p>Stop errors from showing in the client log when working with DateTimePicker in tables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xOGndAeyGuHAZ3fxGT-4Eg.jpeg" /><figcaption><a href="https://stocksnap.io/author/775">Wilfred Iven</a> © stocksnap.io</figcaption></figure><p><em>Authors: </em><a href="https://medium.com/@leonard.blunt"><em>Leonard Blunt</em></a><em>, </em><a href="https://medium.com/@gregorius.adrian1994"><em>Greg Ekaprana</em></a><em>, </em><a href="https://medium.com/@okkasudaryanto"><em>Okka Sudaryanto</em></a><em>, </em><a href="https://medium.com/@diorellatom"><em>Diorella Mari Tom</em></a></p><h3>Introduction</h3><p>The DateTimePicker view is a BAW UI toolkit component that creates an input text field and a calendar to select date and time data. This article details how to avoid somewhat harmless but confusing errors when using the DateTimePicker within a data table.</p><pre>Note: For performance in a larger table, it&#39;s better to use an Output Text with a formatted date for showing the date. To update the Date in a large table, it&#39;s better to add an icon in the cell that will open a modal that consists of DateTimePicker view.</pre><p>If we assign a Date variable to the DateTimePicker when the data is empty, the ‘Console’ tab will not show any error and it will work smoothly.</p><p>If we fetch another date and update the Business Object that already contains a date inside it, the front-end date will change the new value. But, the ‘Console’ log in the browser will show several errors as shown in Figure 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Faf1Hb_BlYHQrlFXjGyWQg.png" /><figcaption>Figure 1. Error of DateTimePicker when updating the Business Object</figcaption></figure><p>Through investigation we observed that this error only occurred if we use and update the business object that has a nested date property. If the DateTimePicker is used in a form, it only showed once when we update the Business Object.</p><p>To avoid this type of error occurring the developer should</p><ul><li>In the case that the DateTimePicker is part of an input form, when fetching the data from database or other data source, it’s better to parse the result to TWDate() type rather than Date() type.</li></ul><pre>//DTPExample is the object<br>tw.local.dataOuput = new tw.object.DTPExample();</pre><pre>var date = new TWDate(tw.local.date1);<br>tw.local.dataOutput.myDate = date;</pre><pre>...</pre><ul><li>In case that the DateTimePicker in a table, it’s advisable to assign to the DateTimePicker directly to DateTimePicker in each row and column rather than assign it to the Business Object.</li></ul><pre>...</pre><pre>for(var i = 0; i &lt; numberOfData; i++){<br> console.log(data[i].data1, data[i].data2);<br> var parsedDate = CheckDate.parseDate(data[i].data2);<br> console.log(&quot;Data number &quot; + i, parsedDate);<br> _this.ui.get(&#39;dtpExample/dtp&#39;, i).setDate(data[i].data2);<br>}</pre><pre>...</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19b4253a549b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-business-automation-ap-el/ibm-business-automation-workflow-using-datetimepicker-in-tables-19b4253a549b">IBM Business Automation Workflow Using DateTimePicker in Tables</a> was originally published in <a href="https://medium.com/ibm-business-automation-ap-el">IBM Digital Business Automation Tips and Assets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IBM Business Automation Workflow Creating a Reusable JavaScript Library]]></title>
            <link>https://medium.com/ibm-business-automation-ap-el/ibm-business-automation-workflow-creating-a-reusable-javascript-library-16e13698596f?source=rss-c3c7dff61ca0------2</link>
            <guid isPermaLink="false">https://medium.com/p/16e13698596f</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[baw]]></category>
            <category><![CDATA[workflow]]></category>
            <category><![CDATA[mpb]]></category>
            <category><![CDATA[tips-and-tricks]]></category>
            <dc:creator><![CDATA[Gregorius Adrian Ekaprana]]></dc:creator>
            <pubDate>Tue, 07 Apr 2020 09:01:01 GMT</pubDate>
            <atom:updated>2020-04-07T09:01:01.061Z</atom:updated>
            <content:encoded><![CDATA[<p>Setting up and using reusable JavaScript libraries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*cOHNtM9EUPHEvQfYqtKUxA.jpeg" /><figcaption><a href="https://www.123rf.com/profile_gregorylee">Yulia Grogoryeva</a> © <a href="http://www.123rf.com/">123RF.com</a></figcaption></figure><p>Authors: <a href="https://medium.com/@leonard.blunt">Leonard Blunt</a>, <a href="https://medium.com/@gregorius.adrian1994">Greg Ekaprana</a>, <a href="https://medium.com/@okkasudaryanto">Okka Sudaryanto</a>, <a href="https://medium.com/@diorellatom">Diorella Mari Tom</a></p><h3>Introduction</h3><p>In the process of developing workflows, it is not unusual to see an evolution of many duplicate JavaScript functions. Our time in writing and debugging code can be saved through the establishing of reusable scripts and functions.</p><p>This article will show how to setup reusable JavaScript functions for IBM Business Automation workflow.</p><h3>Building Reusable JavaScript Function using Web Files</h3><pre>Reminder: When developing using Web Files, it is advisable to test it beforehand. If the system catches an error from Web and/or Server files, it will cause the entire application showing the error of the file rather than the module that using the function from the file.</pre><p>When writing Coach Views and Service Flows for IBM Business Automation Workflow projects their same functions will inevitably be created in several Client-Side Human Services, Coach Views, and Service Flows. We recommend you set out to discover these as quickly as possible so that you can promote reuse within the project team saving the time to write and debug similar code multiple times.</p><pre>Timing is somewhat key here you need to start promoting reuse early in the development cycle and promote the reuse culture within the development team. The value of a common script library is significantly diminished if done as an afterthought, we typically do not recommend refactoring of code to achieve it. So, it is best done as a forward engineering approach.</pre><p>To minimize the time wasted in repetitive coding, developers can work create a library of reusable functions which get uploaded as JavaScript (.js) files to the Web/Server Files in the process Application. If you are working collaboratively with multiple developers, you should organize the way developers keep track, create, update and deploy the code. Use also tools to help with the process such as git. BAW process designer can’t directly integrate with external development tools but one practice we can do with git is by keeping the files in the git repository and only upload the latest .js files to BAW Web/Server files.</p><p>IBM Business Automation Workflow has a specific template for the JavaScript File that must be followed in order for it to read the functions inside a script file. The template requires that the developer:</p><ol><li>Check whether the name of the Function Library or Object already used inside the IBM Business Automation Workflow naming space Function or JavaScript in general. In order to minimize the conflict, it is advisable to name the Function Library by using uppercase for each first letter from each word and using the JavaScript name as the prefix for each function. The example for this part will be shown below.</li><li>Check whether the name of the Function already used inside the IBM Business Automation Workflow naming space Function or JavaScript in general. As the file created outside the system, it’s suggestible to create the file for specific sets of function (i.e. JavaScript for processing date data, JavaScript for processing string data, etc.) and make documentation for the function.</li></ol><p>An example of the syntax for these two checks follows</p><pre>if(typeof <strong>&lt;name of the Function Library&gt;</strong> !== &quot;object&quot;){<br>    <br>    <strong>&lt;name of the Function Library&gt;</strong> = {};<br>}</pre><pre>//Function Structure<br>(function (){<br>    if(typeof <strong>&lt;name of the Function Library&gt;.&lt;name of function&gt;</strong> <br>                                                   !== &quot;function&quot;){<br>      <br>         <strong>//Put your code here</strong><br>    }</pre><pre>//You can put more than one function. But remember to add the <br>    //check around the function code.</pre><pre>}());</pre><p>Example of how this looks with two simple date functions follows:</p><pre>if(typeof CheckDate !== &quot;object&quot;){<br>CheckDate = {};<br>}</pre><pre>(function(){<br>      // Function to parse Date to String<br>      if(typeof CheckDate.parseDate !== &quot;function&quot;){<br>          <br>          /**   <br>           *   Parse a Javascript Date to a string format<br>           *   in: Date<br>           *   out: &quot;dd/MMM/YYYY&quot;<br>           *  <br>           *   Date       Change By      Comment<br>           * =================================================<br>           *  05/12/2019  G.Ekaprana       Created<br>           *<br>           */<br>          checkDate.parseDate = function(val){<br>              var listMonth = [&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, <br>                               &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;, <br>                               &quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, <br>                               &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot;];<br>              var myDate = new Date(val);<br>              var day = mydate.getDate();<br>              var month = myDate.getMonth();<br>              var year = myDate.getFullYear();</pre><pre>return day + &quot;/&quot; + listMonth[month] + &quot;/&quot; + year;<br>          }<br>     }</pre><pre>if(typeof CheckDate.addDate != &quot;function&quot;){<br>          /**   <br>           *   Add two dates together<br>           *   in: First Date, Second Date<br>           *   out: &quot;dd/MMM/YYYY&quot;<br>           *  <br>           *   Date       Change By      Comment<br>           * =================================================<br>           *  05/12/2019  G.Ekaprana       Created<br>           *<br>           */<br>          CheckDate.addDate = function(val, add){</pre><pre>return val.setDate(val.getDate() + add);<br>           }<br>     }<br>}());</pre><p>After a developer creates their script file the file needs to be uploaded into the Process Application.</p><h4><strong>Upload and Update Reusable JavaScript</strong></h4><p>To use the JavaScript script to Coach View or Service Flow, the JavaScript files need to be uploaded to the system. Here are the steps on how to upload the file to the system:</p><ul><li>Click the ‘File’ tab and click on the ‘+’ sign. It will show three types of New File to be uploaded (Web File, Server File, and Design File)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*jnBzzO3YLRWUmsDeLJ5R9w.png" /><figcaption>Figure 1. File Tabs</figcaption></figure><ul><li>Click Server File and it will prompt a pop-up window.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*R5xK8FC1kpryJ9cLucYjDg.png" /><figcaption>Figure 2. New File Upload</figcaption></figure><ul><li>Choose a file from your Local Computer by clicking on the document icon</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*dZsu5Cnpe5g9DEFiTMPMAg.png" /><figcaption>Figure 3. Create New Server File</figcaption></figure><ul><li>After you finished uploading the file, click the ‘Finish’ button.</li></ul><p>When you are in the middle of the development, there will be an instance where the JavaScript file needs to be updated for a new function from the local machine and we need to update the file in the IBM Business Automation Workflow itself. Here are the steps on how to update the document:</p><ul><li>Click the ‘Files’ tab. It will show the list of File uploaded to the IBM Automation Workflow.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*Aj9v_zosUWjJoa44dGmxvA.png" /><figcaption>Figure 4. Files Tabs on IBM Business Automation Workflow</figcaption></figure><ul><li>Choose the file you want to be updated. It will show the page information of the file.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YMFZPPn2VKtXKxQduqXvuQ.png" /><figcaption>Figure 5. Detailed file page</figcaption></figure><ul><li>Click on the small folder icons beside the file upload area as shown in red.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3bhU5DOBA6_NalEQkZGG8g.png" /><figcaption>Figure 6. Select File</figcaption></figure><ul><li>After you finished uploading the file, click the ‘Upload’ button</li></ul><h4><strong>Using a Reusable Script in a Service Flow</strong></h4><p>To use a reusable function in the Service Flow:</p><ol><li>Make sure that the file is uploaded to the WebFiles in the process application.</li><li>Use the syntax <em>&lt;name of the Function Library&gt;.&lt;name of the Function&gt;</em>to call the function:</li></ol><p>For example, let’s use the parseDate function from our earlier example:</p><pre>...<br>var date = new Date();<br>var myDateString = CheckDate.parseDate(date);<br>//Continue your code here</pre><h4><strong>Usage a Reusable Script in a Coach View</strong></h4><p>To use a reusable script Coach View</p><p>First, put the files into the ‘Included Scripts’ on your coach view by clicking the add (+) sign on the ‘Included Scripts’ folder and choose the file(s) that contain the scripts needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*H6HBRMcQnrKKAbPuId9v_Q.png" /><figcaption>Figure 7. Included Scripts with CheckDate.js</figcaption></figure><p>Once the script files are in place, the functions may be called from within the scripts of the coach view. Use this syntax:</p><p><strong><em>&lt;name of the Function Library&gt;.&lt;name of the Function&gt;</em></strong></p><p>Here is an example of calling functions:</p><pre>...<br>var date = this.ui.get(&#39;dtp1&#39;).getDate();<br>var pDate = CheckDate.parseDate(date);<br>...</pre><p>This script only applies for Inline Script of the Coach View.</p><h4><strong>Drawback for using JavaScript File</strong></h4><p>When using JavaScript File as the reusable function in IBM Business Automation Workflow, there will be some drawbacks, and these are:</p><ol><li>It is hard to know whether the function is already created or not. To minimize a repeatable function, it is better to make documentation or git for each file. The documentation and/or the git should be accessible for the developer.</li><li>There is no searchable document function in IBM Business Automation Workflow. Because of that, the file documentation and/or git is vital if working with a lot of developers.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16e13698596f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-business-automation-ap-el/ibm-business-automation-workflow-creating-a-reusable-javascript-library-16e13698596f">IBM Business Automation Workflow Creating a Reusable JavaScript Library</a> was originally published in <a href="https://medium.com/ibm-business-automation-ap-el">IBM Digital Business Automation Tips and Assets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IBM Business Automation Workflow Simplifying Debugging]]></title>
            <link>https://medium.com/ibm-business-automation-ap-el/ibm-business-automation-workflow-simplifying-debugging-b5fceab56dc7?source=rss-c3c7dff61ca0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5fceab56dc7</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[workflow]]></category>
            <category><![CDATA[ibm]]></category>
            <category><![CDATA[tips-and-tricks]]></category>
            <category><![CDATA[baw]]></category>
            <dc:creator><![CDATA[Gregorius Adrian Ekaprana]]></dc:creator>
            <pubDate>Tue, 17 Mar 2020 09:01:01 GMT</pubDate>
            <atom:updated>2020-03-17T09:01:01.148Z</atom:updated>
            <content:encoded><![CDATA[<p>A few simple tips that can simplify your client side debugging to speed up UI development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SYfRoMRvzGIEwMzIiseXjQ.jpeg" /></figure><p><em>Authors: </em><a href="https://medium.com/@leonard.blunt"><em>Leonard Blunt</em></a><em>, </em><a href="https://medium.com/@gregorius.adrian1994"><em>Greg Ekaprana</em></a><em>, </em><a href="https://medium.com/@okkasudaryanto"><em>Okka Sudaryanto</em></a><em>, </em><a href="https://medium.com/@diorellatom"><em>Diorella Mari Tom</em></a></p><h3>Code Repository</h3><p><a href="https://github.com/IBM-BAW-Assets/tips-for-baw-tk">Tips for BAW Toolkit Git Repository</a></p><h3>Introduction</h3><p>This article will give new developer tips on debugging IBM Business Automation Workflow. There are three ways to debug IBM Business Automation Workflow:</p><ul><li>Source URL Name</li><li>console.log</li><li>Java Logger Wrapper</li></ul><h3>Source URL Name</h3><p>In Client-Side Human Service (CSHS), there can be instances that we include JavaScript within the Coach by creating a Custom HTML component and inside that HTML we insert an HTML script tag, see example in Figure 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zSESp01EDbsJRUHphA4uFw.jpeg" /><figcaption>Figure 1: Simplifying Debugging Example CSHS using Custom HTML component</figcaption></figure><p>If we want to debug the code, we usually add the <strong><em>debugger;</em></strong> statement (see line 7 in Figure 1), which invokes the debugger when the statement is encountered. When we run the Simplifying Debugger Example CSHS, the debugger is encountered but the source code of the function is not displayed, which is shown in Figure 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SGOEtTg3_0Lp7dr9kVZbxA.jpeg" /><figcaption>Figure 2: Debugging CSHS using “debugger;” statement</figcaption></figure><p>One way to debug this is by inserting a comment at the end of the source function that is of the form:</p><pre>//# sourceURL=filename.js</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*JDw2_EIgRDyqC5Qk1LvihA.jpeg" /><figcaption>Figure 3: generateID() function using sourceURL comment</figcaption></figure><pre>Note: You can declare any name for &quot;filename.js&quot; as shown in generateID() function in Figure 3.</pre><p>When you run again the CSHS example, it will now show the source code of the function as expected, see Figure 4. You can now have a full access to the client-side source function where you can step through the code and place breakpoints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iWlv7tby09c0wqyZr-U4Mg.jpeg" /><figcaption>Figure 4: Debugging CSHS using sourceURL comment</figcaption></figure><h3>console.log</h3><p>Adding logs in the client side using the console log can be a quick way to explore errors and get further information on logging. It prints out the logged information to the ‘Console’ Tab of the browser.</p><p>Most people know the common string build approach which has it limited value and is demonstrated in this simple example</p><pre>var date1 = new Date();<br>console.log(&quot;Test 01 &quot; + date1);</pre><p>This console log will show the string that you entered together with the variable of your choice. If the variable type is complex, it will show ‘[Object Object]’ rather than the inside of the object.</p><p>Perhaps less commonly known for beginners but very powerful when working with objects and JavaScript API’s from the various IBM UI toolkit or services is to use the ‘coma’ log notation which will log an object in detail. A very useful tip that helps you quickly understand the objects that you are working with.</p><pre>var myObject = [];<br>myObject.name = &quot;I&#39;m one&quot;;<br>myObject.data = &quot;For Check&quot;;<br>console.log(&quot;Test 01&quot;, myObject);</pre><p>Example of the console.log result when using a complex object</p><pre>console.log(&quot;The data 1 : &quot; + res.result);</pre><pre>console.log(&quot;The Data 2 : &quot;, res.results);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*rCS5ocJa6LVijU1WoreByw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*cQ7aPSiUtk9K0_vaUY8Wnw.png" /></figure><p>This console log will show the string that you entered together with the variable of your choice. If the variable type is complex, it will show the structure of the object. If the variable type is complex and a list it will help you to see the items lists and structure of contained items.</p><p>It is considered a good practice to disable or remove debug logging before promotion of code to test. The console.log does not really impact performance in a way that you will notice the effect but it’s rather because its easy for a layman to read your logs and there’s a risk of sharing some sensitive data about your application.</p><p>There is one tip for turn on and off the console log without commenting or deleting the entire console log in the code.</p><p>It is by instantiating a variable as a Boolean (i.e. variable name is ‘LogOn’), put as global variable and instantiate it before every console log. If the developer wants to check the console log, they could set the the variable <strong><em>true</em></strong> and if the testing is already finished set the variable <strong><em>false</em></strong>. Methodical coding of entry conditions for functions using this approach can help to save a lot of time in debugging.</p><pre>var logOn = true;<br>//Change variable logOn to False if you don&#39;t need logging the information again</pre><pre>if(logOn){<br>    <br>     console.log(&quot;The Data 1 :&quot;, res.results);<br>    //Put other console.log under logOn<br>    ...<br>}</pre><h3><strong>Java Logger Wrapper</strong></h3><p>When we are testing processes, human services and service flows, sometimes we want a lot of details regarding the issue or sometimes less information only. To capture the details needed, we can use the <a href="https://github.com/IBM-BAW-Assets/tips-for-baw-tk/blob/master/logger-wrapper.jar">Java Logger Wrapper</a> which is a combination of java.util.Logger and WebSphere Application Server (WAS) logging and tracing to configure log settings. When these logs are activated, it should be viewed from the server log.</p><p>Java Logger Wrapper consists of two methods: isLoggable and logp. These methods are use in the following service flows:</p><ol><li>Java Logger isLoggable — checks if a message of a given level should be logged by this logger or not. This method accepts two input parameters: loggerName &amp; loggerLevel, and returns isLoggable, see details in Figure 6.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BNrecvxfBPBWOfJZRXNXlQ.jpeg" /><figcaption>Figure 5: Java Logger isLoggable Service Flow</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wa3QkV0clxur7tKnDnDpBg.jpeg" /><figcaption>Figure 6: Java Logger isLoggable Parameters</figcaption></figure><p>2. Java Logger logp — used to log a message which accepts six parameters: loggerName, loggerLevel, sourceLocation, sourceOperation, message and addProcessInfo, see details in Figure 8.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DA32lCLzgdd3aVda6ngAoA.jpeg" /><figcaption>Figure 7: Java Logger logp Service Flow</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*0Y1TdUEFe4lfnshsLO8wDg.jpeg" /><figcaption>Figure 8: Java Logger logp Parameters</figcaption></figure><h4><strong>Log Levels</strong></h4><p>We need to specify the desired level of logging every time we interact with the log system. Log levels controls the logging details and each level is associated with a numeric value, see details in Table 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VwpKY1edlSnDcb07WK_PJA.jpeg" /><figcaption>Table 1: Log Levels</figcaption></figure><pre>By using the logp and Log levels of java for your server side logging the logs created will follow the server standards and the logs can be analysed with log tools that read the IBM application Server Log format. This creates a consistency in the logging approach. </pre><h4>Configuring the log settings in Admin Console</h4><p>The log level is administered in the admin console. Before running your application with logging on, you need to set the log active at the right level. This is done using IBM BAW WebSphere Application Server administrative console, you can specify or change the level detail in a log, you can check the procedure in this <a href="https://www.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.multiplatform.doc/ae/ttrb_configjavalog.html">link</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J6YFwMWlaMQ5KaRfu9reTg.jpeg" /><figcaption>Figure 9: Change Log Detail Level in WAS Admin Console</figcaption></figure><p>There are two ways to view your logs: first, view the JVM logs from the administrative console and second, view the JVM logs from the machine where they are stored, you can check the procedure in this <a href="https://www.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.multiplatform.doc/ae/ttrb_viewmsglogs.html">link</a>. Here is an example view of message log:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8iPynPPa9rTDUU38HA6YFw.jpeg" /><figcaption>Figure 10: SystemOut.log Message</figcaption></figure><h4><strong>Example</strong></h4><p>The following examples shows how to use the basic logging capabilities of Java Logger Wrapper. Please note that the log level is configure to FINE as shown in Figure 9.</p><ol><li>Log message after an error — Using Java Logger logp service, we can log the error message after encountering it.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*utrc_b4FBW7GccDn9pK9TQ.jpeg" /><figcaption>Figure 11: Example of Logging an Error</figcaption></figure><p>Notice in the data mapping, the log level is set to FINE (500), which means if error occurs the message will be logged as shown in log message in Figure 12.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VxzaE9n6uotYYPlRoKQfWA.jpeg" /><figcaption>Figure 12: Error Message Logged in SystemOut.log</figcaption></figure><p>2. Log message in general flows — Using Java Logger isLoggable service, we check first the log level setting before logging the message, otherwise no message will be logged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uwIIOTA8sLrpJdtul4o1NA.jpeg" /><figcaption>Figure 13: Example of Logging Message in General Flows</figcaption></figure><p>The log message will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8iPynPPa9rTDUU38HA6YFw.jpeg" /><figcaption>Figure 14: Sample Message Logged in SystemOut.log</figcaption></figure><p>In case you do not want to show the process task and/or user context information in the log message (information enclose in braces []), you can set the addProcessInfo parameter to ‘false’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rbk4RLLBDcLD89GQkXFh-w.jpeg" /><figcaption>Figure 15: Setting up the addProcessInfo Parameter in Java Logger logp Service Flow</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-qoKcM0cW_JuBOjXC3bQMw.jpeg" /><figcaption>Figure 16: Log Message with no Process Task and/or User Context Information</figcaption></figure><pre>Remember: If you are in a team with multiple developers working on the same application, you need to consider 3 main things in logging messages: <br>1. Must be easily identified and distinguishable from other logs by other developers, or threads in the server (avoid the I&#39;m Here paradigm), <br>2. Should be meaningful and understandable by others.  <br>3. Should include data that makes it searchable</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5fceab56dc7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-business-automation-ap-el/ibm-business-automation-workflow-simplifying-debugging-b5fceab56dc7">IBM Business Automation Workflow Simplifying Debugging</a> was originally published in <a href="https://medium.com/ibm-business-automation-ap-el">IBM Digital Business Automation Tips and Assets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IBM Business Automation Workflow Service Flow Execution Models From UI]]></title>
            <link>https://medium.com/ibm-business-automation-ap-el/ibm-business-automation-workflow-service-flow-execution-models-from-ui-17a99f8aa515?source=rss-c3c7dff61ca0------2</link>
            <guid isPermaLink="false">https://medium.com/p/17a99f8aa515</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[workflow]]></category>
            <category><![CDATA[tips-and-tricks]]></category>
            <category><![CDATA[ibm]]></category>
            <category><![CDATA[baw]]></category>
            <dc:creator><![CDATA[Gregorius Adrian Ekaprana]]></dc:creator>
            <pubDate>Mon, 09 Mar 2020 23:01:01 GMT</pubDate>
            <atom:updated>2020-03-09T23:01:01.430Z</atom:updated>
            <content:encoded><![CDATA[<p>Explores the different ways that a developer can invoke service flows from the UI Toolkit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*6KU1f3PMfj36W2cP8_SeRw.jpeg" /><figcaption><a href="https://www.123rf.com/profile_belchonock">belchonock</a> © <a href="http://www.123rf.com/">123RF.com</a></figcaption></figure><p><em>Authors: L</em><a href="https://medium.com/@leonard.blunt"><em>eonard Blunt</em></a><em>, </em><a href="https://medium.com/@gregorius.adrian1994"><em>Greg Ekaprana</em></a><em>, </em><a href="https://medium.com/@okkasudaryanto"><em>Okka Sudaryanto</em></a><em>, </em><a href="https://medium.com/@diorellatom"><em>Diorella Mari Tom</em></a></p><h3>Code Repository</h3><p><a href="https://github.com/IBM-BAW-Assets/tips-for-baw-tk">Tips for BAW Toolkit Git Repository</a></p><h3>Introduction</h3><p>This article will discuss and demonstrate the different ways that a service can be invoked from within the IBM Business Automation Workflow UI. Three models of how to execute service flows will be explored, these include:</p><ol><li><a href="https://medium.com/p/17a99f8aa515#6fa3">Task based execution of Service Flows in the context of a human service task flow (Client-Side Human Service)</a></li><li><a href="https://medium.com/p/17a99f8aa515#1342">Service Call control in Coach View, which is part of the IBM UI Toolkit</a></li><li><a href="https://medium.com/p/17a99f8aa515#8873">A variable defined in Coach View as type service</a></li></ol><h3>Using the Service Flow Task</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*bQa7FwJXE1B8Nzy6eEVQiA.jpeg" /><figcaption>Figure 1: Service Call in CSHS</figcaption></figure><p>The service flow task can be added by selecting the service from the list of services and dragging it on the flow (Figure 2), or by clicking the service icon on the right of the flow view and then selecting the service by using the select button from within the <strong>Implementation</strong> tab for the new service (Figure 3).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SpVyrnfBhwJSOFf0kviQPA.jpeg" /><figcaption>Figure 2: Drag existing service onto CSHS Flow</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PWmqlMQK1CbFrbPaGaYC1A.jpeg" /><figcaption>Figure 3: Use the service Icon and Manually configure the service to invoke in the Implementation tab</figcaption></figure><p>After service to invoke is set complete the <strong>Data Mapping</strong> tab by assigning the Input and Output parameters (Figure 4)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9cva6g-qDkYS4mq3vJomSQ.jpeg" /><figcaption>Figure 4: Data Mapping Tab</figcaption></figure><p>Should it be required each service also supports a pre and post script execution in the <strong>Pre &amp; Post</strong> tab (Figure5).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*41iUjRECJhEb8_6RolFU7A.png" /><figcaption>Figure 5: Pre &amp; Post Tab</figcaption></figure><h3>Using ‘Service Call’ control in Coach View</h3><p>Another way to execute a service in the Coach View is to use the ‘Service Call’ control. This control is used to invoke an Ajax service which can be called On Load, or programmatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9B1A4nYjEX9B_WMS-qTRPA.jpeg" /><figcaption>Figure 6: Service Call Data Binding</figcaption></figure><pre>Note: The Service Call control does not need to be bound for it to work.</pre><p>When this control executes, it runs the service flow with Ajax access that uses two variables; one as the input data for the Ajax Service, and outputs the result bound to this control.</p><pre>Remember: The input of the Ajax service must be named ‘data’, which can be of any type of data object. The output of the Ajax service must be named ‘results’, which you can leave the data object of ANY, unless you want to specify what the output will be (e.g. List, String, Decimal). To return an error, an AjaxError object should be used as an output variable named ‘error’.</pre><p>The events are fired when the you get a result or error from the Ajax call. Here’s a simple example that shows how to retrieve a list of data in the database by using a Service Call control.</p><ul><li>Create a Service Flow that will run the Ajax service when the control is executed</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MES_71Y7Rk0Zu1zUfRpGuw.jpeg" /><figcaption>Figure 7: GetCustomerInformationList Service Flow and Variables</figcaption></figure><ol><li>Set SQL Statement</li></ol><pre>SELECT<br>   ID, FIRSTNAME, LASTNAME, DEPARTMENT, JOBTITLE<br>FROM &lt;#= tw.env.DSN_NEWSCHEMA_NAME #&gt;.EG_CUSTOMER_INFO</pre><p>2. Execute SQL by implementing SQLConnector service</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gAxg9e85p8fTbn4o5LtwQA.jpeg" /><figcaption>Figure 8: SQLConnector implementation to execute the SQL</figcaption></figure><ul><li>Add the Service Call control in the Coach View and set up the configuration option</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*iWjw5XBoNdgaMt1zQAzq8Q.jpeg" /><figcaption>Figure 9: Service Call Configuration Options</figcaption></figure><ul><li>Create a JavaScript function that will invoke the execute function of the control which runs the attached Ajax service and then call the function in ‘load’ event of the coach view.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*p_fFkK246ZEfDzvqcOg74Q.jpeg" /><figcaption>Figure 10: Inline Javascript Function — getCustomerInfoList()</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4XoGOM97bDYv_r2-3d4Jcw.jpeg" /><figcaption>Figure 11: Load event of the coach view</figcaption></figure><pre>Note: In this example, input data is not used in the service call as this value is optional. In case, you use input data to the service call, you need to pass the parameter to the execute function <br>(e.g. _this.ui.get(&quot;svcGetCustInfoList&quot;).execute(input);)</pre><ul><li>Create a JavaScript function that will set the output result of the service call and then call the function in ‘On result’ event of the service call control.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*A6K_wu5G7WZ9udTHDmc4tA.jpeg" /><figcaption>Figure 12: Inline Javascript Function — setCustomerInfoList()</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*h4eHcgXUKfPfR0uwVUXohA.jpeg" /><figcaption>Figure 13: On result event of Service Call control</figcaption></figure><ul><li>When an error occurs and you want to catch any errors returned from the service, create a JavaScript function that will display the error and then call the function in ‘On error’ event of the service call control.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*ScPI8uhwfPhmK1DYuZLxUQ.jpeg" /><figcaption>Figure 14: Inline Javascript Function — displayAlert()</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-a6O-rxd1JMIWGnSSc3spQ.jpeg" /><figcaption>Figure 15: On error event of Service Call control</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9W2mu__kL_QrIi2VHw86KQ.jpeg" /><figcaption>Figure 16: Service Call Example: Display Error Message</figcaption></figure><ul><li>To test, run the Service Flow Task Example CSHS and this should display the Customer Information List table in Figure 17.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5UHlRQ-flEQUP0p3LbcTtg.jpeg" /><figcaption>Figure 17: Service Call Example — Customer Information List</figcaption></figure><h3>Using ‘Service’ Variable in Coach View</h3><p>To call a service in the coach view, you must specify the configuration options of type ‘Service’ in the coach view variable declarations and then select the service flow as a default service to be used. The default service is the application programming interface (API) for which custom services must match. The names and types of both inputs and outputs must match.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fEYiV4TZlgxwdM5z__E_Xg.jpeg" /><figcaption>Figure 18: Coach View Variable Declaration — Service Type</figcaption></figure><p>The service can be invoked by a simple JavaScript call syntax. Use this syntax format:</p><pre>this.context.options.&lt;service_option_name&gt;(args)</pre><p>Here is the example JavaScript call and the details of the arguments:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*vXHgNn2ZS5SI3Vm1FI5O4g.jpeg" /><figcaption>Figure 19: Example of JavaScript Call — addData() function</figcaption></figure><ol><li>params — This represents the input to the service. The name of the input variable of the service flow must be the same name define in the syntax for it to execute the service.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*HnQtkpQd9O0sJXwLFzTAmg.jpeg" /><figcaption>Figure 20: Sample Syntax for params property</figcaption></figure><p>2. load — A callback function when the service call returns successfully. The callback function has a single parameter containing the output(s) of the service call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JBeq5AQ-rBvukexjgodALg.jpeg" /><figcaption>Figure 21: Sample syntax for load property</figcaption></figure><p>AddCustomerData service flow has two outputs: <em>results (ANY)</em> and <em>error (AjaxError)</em>. If the service returns successfully, the parameter (<em>data</em>) of ‘load’ function which contains these two outputs will be returned. Any error occurred during SQL execution will be caught and handled by the error handler service as shown in Figure 22. The catch error is set in the output variable: <em>error (AjaxError)</em>. From the sample code, we need to make sure that the customer data is successfully added by checking if the service returns an error otherwise, continue with the processing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WbjUdjsXvfL8sVFkhKHlIQ.jpeg" /><figcaption>Figure 22: Details of ‘load’ function</figcaption></figure><p>If the service returns successfully, it will refresh the list of customer data and display a success message shown in Figure 23.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IITGisdE41yLYr0zdRT6oQ.jpeg" /><figcaption>Figure 23: Customer Data is successfully added</figcaption></figure><p>In case the service returns successfully but the customer data is not added, service will return an error and displays the error message shown in Figure 24.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K44LDyMOUfMmteT7epj4Bg.jpeg" /><figcaption>Figure 24: Sample error message displayed if service call returns an error</figcaption></figure><p>In case the error does not occur on the SQL execution but on the Server Scripts, then this error will be handled in the ‘error’ function which will be explain on the next item.</p><p>3. error — A callback function when the service call results in error. The callback function has a single parameter containing the error information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yNjMRzGyWqe5xeCrTuIyWA.jpeg" /><figcaption>Figure 25: Sample syntax for error property</figcaption></figure><p>If an error is thrown by an error event as shown in Figure 26 or if an error occurs on any activity in the service flow which is not caught by an error event, then this triggers the ‘error’ function. From the sample code, if the service call results to an error, then it will display the error message as shown in Figure 27.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s24CGpelJOGUrDE1Vg3bBg.jpeg" /><figcaption>Figure 26: Shows how ‘error’ function is invoked</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HKDtVAwYOkg4SaB7n8DRSg.jpeg" /><figcaption>Figure 27: Sample error message displayed if service call results an error</figcaption></figure><pre>Note: To use ‘this’ keyword inside the argument, you must first declare it as a global variable then use the assign variable in the argument as shown in Figure 28, otherwise it will cause an error on runtime.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sapa-NqBwQG9hXFSE19bUw.jpeg" /><figcaption>Figure 28: Using ‘this’ keyword inside the argument</figcaption></figure><h3>Summary</h3><p>In choosing which way to use in executing a service flow, it would still depend on a given scenario. Here are things to remember on implementing Service Flow:</p><ul><li>With Client-Side Human Services, everything that is needed to show data to the user and interact with it is already loaded within the browser. At runtime, when user has done performing tasks using the user interface but there’s a post processing needed which the activity calls another service, then you can implement Service Flow task in Client-Side Human Service. With this, the user won’t need to wait for the service to complete, instead the user sees that the transaction is complete, while the service runs in the background.</li><li>A Coach View runs within the browser and doesn’t have direct access to any server-side data. If you are building Coach Views and you want to make it reusable, you can use Service Call control and/or Service type variable to invoke an Ajax service.</li><li>You can use Service Call control in a Coach View, if you want to implement an Ajax service call with a simple input (data) and output (result) parameter only, but if you are dealing with a complex parameters having 2 or more input/output, you can use the Service type variable to simplify the creation and passing of parameters using the JavaScript call syntax.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17a99f8aa515" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-business-automation-ap-el/ibm-business-automation-workflow-service-flow-execution-models-from-ui-17a99f8aa515">IBM Business Automation Workflow Service Flow Execution Models From UI</a> was originally published in <a href="https://medium.com/ibm-business-automation-ap-el">IBM Digital Business Automation Tips and Assets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>