◇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]
When you take advantage of the automated Processes, such as the [Script Step], you will have significant benefits, such as "unmanned" or "speed".
However, on the other hand, the Knowledges of "HTTP communications" and "JavaScript" will be needed in proportion to the degree of "Automation". That means, there occurs a new risk that "people who are capable of maintenance are limited".
In this example, JavaScript in 50 lines and 100 lines have been set in two [Script Step] respectively.
It sure is not a very complex Scripts. Also, speaking of only this example, it is difficult to assume a case where modification is required. However, yet, you'd better off using it on tight consideration about the "Risks" in the operation of Workflow beforehand.
[Automatic check of Trade-name Registration in Customer Master #2:"1. " screen]
▼ Setting sample for Script Step "Count # of clientsXML" (Server-side JavaScript)
//// == Retrieving == // XML file registered in [Common Files] (M319) // returns "List<ItemView>" optionsList = itemDao.findAll("Business-Connections.xml", true); //// == Calculating == var numOfClients = 0; // javascript number numOfClients = optionsList.size(); // The number of registered Trade partners var clientsCorporateNumbers = ""; // javascript string var clientsCorporateNames = ""; var iRequestCorporateNumbers = ""; // javascript string var iCorporateNames = ""; for (j = 0; j < numOfClients; j++){ clientsCorporateNumbers += optionsList.get(j).getValue().substr(7, 13) + "\n"; clientsCorporateNames += optionsList.get(j).getDisplay() + "\n"; if ( j < 10 ){ // Setting up to 10 instances (Separate Corporate Numbers with comma) if ( optionsList.get(j).getValue().substr(7, 13) != "9999999999999" ){ iRequestCorporateNumbers += optionsList.get(j).getValue().substr(7, 13) + ","; iCorporateNames += optionsList.get(j).getDisplay() + "\n"; } } } if ( iRequestCorporateNumbers == "" ){ // If no Corporate Number has set iRequestCorporateNumbers = "6130001031686"; iCorporateNames = "Questetra, Inc."; } var numOfLoops = 0; // javascript number numOfLoops = Math.ceil(numOfClients / 10) ; // How many loops of 10 instances required? //// == Updating == retVal.put("1", java.math.BigDecimal(numOfClients) ); retVal.put("2", java.math.BigDecimal(numOfLoops) ); retVal.put("3", clientsCorporateNumbers ); retVal.put("4", clientsCorporateNames ); retVal.put("5", java.math.BigDecimal(0) ); // i=0 retVal.put("6", iRequestCorporateNumbers ); // Initial request retVal.put("7", iCorporateNames ); // List of Business names retrieved in the initial request retVal.put("11", "vvv Check Log vvv\n" ); // Escape null if( numOfClients == 0 ){ retVal.put("11", "Business-Connections.xml: no such file ?" ); }
▼ Setting sample for Script Step "Res Chk / Req Prep" (Server-side JavaScript)
//// == Retrieving == var i = 0; // javascript number i = data.get("5") - 0; var iRequestCorporateNumbers= ""; // javascript string iRequestCorporateNumbers = data.get("6") + ""; var iCorporateNames = ""; // javascript string iCorporateNames = data.get("7") + ""; var diffLog = ""; // javascript string diffLog = data.get("11") + ""; var iResponseTmp = ""; // javascript string iResponseTmp = data.get("8") + ""; iResponseTmp = iResponseTmp.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); // E4X bug 336551 var iResponseXML = new XML(iResponseTmp); // javascript xml // Setting next 10 instances var numOfClients = 0; // javascript number numOfClients = data.get("1") - 0; var clientsCorporateNumbers = ""; // javascript string var clientsCorporateNames = ""; clientsCorporateNumbers = data.get("3") + ""; // (multi-lines) clientsCorporateNames = data.get("4") + ""; //// == Calculating == var xmlCorporationCount = 0; // javascript number xmlCorporationCount = iResponseXML.count - 0; var iResponseCorporateNames = ""; // javascript string var array = iCorporateNames.split("\n"); var arrayNumber = iRequestCorporateNumbers.split(","); // Requesting order (AAA,BBB,) doesn't match Responding order (xml) for ( j = 0; j < xmlCorporationCount; j++ ){ var k = 0; for ( k = 0; k < 10; k++ ){ if ( iResponseXML.corporation[k].corporateNumber == arrayNumber[j] ){ break; } } iResponseCorporateNames += iResponseXML.corporation[k].name + "\n"; if( array[j] == iResponseXML.corporation[k].name ){ diffLog += "ok: "; } else { diffLog += "NG: "; } diffLog += array[j] + " is " + iResponseXML.corporation[k].name + "\n"; } // Setting next 10 instances var nextiRequestCorporateNumbers = ""; var nextiCorporateNames = ""; // javascript string var array2 = clientsCorporateNumbers.split("\n"); var array3 = clientsCorporateNames.split("\n"); var request10 = 10; // javascript number if ( (i+2) * 10 > numOfClients ){ request10 = numOfClients - (i+1) * 10; // The last loop is negative } if ( request10 > 0 ){ for ( j = 0; j < request10; j++ ){ if ( array2[(i+1)*10+j] != "9999999999999" ){ nextiRequestCorporateNumbers += array2[(i+1)*10+j] + ","; nextiCorporateNames += array3[(i+1)*10+j] + "\n"; } } if ( nextiRequestCorporateNumbers == "" ){ // If no Corporate Number has set nextiRequestCorporateNumbers = "6130001031686"; nextiCorporateNames = "Questetra, Inc."; } retVal.put("6", nextiRequestCorporateNumbers ); retVal.put("7", nextiCorporateNames ); } //// == Updating == retVal.put("5", java.math.BigDecimal(i + 1) ); retVal.put("10", iResponseCorporateNames ); retVal.put("11", diffLog );
[Data Items list]
[Free Download]
- Business Template: Automatic check of Trade-name Registration in Customer Master #2
- Brush-up on Customer Master Data by "Corporate Identification Number System Web-API" (2015-12-07)
- Management of Customer Master Data Using Corporation Number (Collective updating) (2015-09-21)
- Management of Customer Master Data Using Corporation Number (Updating for addition) (2015-09-14)
- Querying External Web-API with Corporation Number (2015-10-26)
- M407 BUSINESS FLOW DATA ITEMS: Setting: Embedded Emails to be Transmitted Repeatedly
- M230 AUTOMATED STEP: Auto Executing Complicated Data Processing (ECMAScript)
- M319 MODELING ENVIRONMENT: Register an Options-XML file to which the Process Model Definitions Refer
[Japanese Entry (和文記事)]