Wiki Page: 04 - How to Create a Rollbase App in 20 Mouse Clicks

Status
Not open for further replies.
M

mparish

Guest
This demo shows how in under 20 mouse clicks you can create a basic web enabled application from data contained in a Spreadsheet. It also includes sample java code for calling Corticon and extracting the result using a single trigger. Make sure you have a CSV file with all the fields you need. One field should identify the record. In this example, the name is the identifying field For example: 1 - Setup 2 - Applications 3 - New Application 4 - Enter name and save 5 - Add a Tab 6 - From external metadata (select CSV file) 7 - Choose Spreadsheet 8 - Browse for CSV file and choose name for Objects 9 - Map the name field of the spreadsheet to the Object and then Create 10 - Return to New Application 11 - Go to Object Definition 12 - Select Views 13 - Select All Objects 14 - Edit 15 - Configure the columns you want to see 16 - Save 17 - Return to Application 18 - Application is ready Using the Basic Application You can now use this app to maintain the various records. A new record can be created: Or an existing record can be edited: Or viewed: Enhancements to the Basic The functionality of the basic app can be enhanced considerably simply by switching on various built in features. For example you can enable: And you can add these properties to your object: This results in additional relevant fields being automatically added to your object. For example location information: Or event related information: We’ll also see that every update is now tracked (because we enabled the Audit property): And because we enabled the contact property we get the ability to send emails: Phone calls, emails sent and received can be tracked using the communication log: You will also notice that in the list of records some additional things happen: There’s a follow up flag that you can use and items that have not yet been viewed are in bold. Enhancing the Application by the addition of a Rules Engine If you need to apply business rules to the records whenever they are created or updated you can use the Corticon rule engine. Step 1 - Create and Deploy a decision service This is not covered in this document. It is assumed you already know how to create a decision model using Corticon and deploy it to the Corticon server. Step 2 Create an Object Script Trigger for your object The object script has three parts: Create the Corticon SOAP payload You can get the correct format by exporting the SOAP from the Corticon tester: It will look something like this: Now you need to reformat it for use as a javascript string Put \ before every “ Put “ at the beginning of every line Put “ + at the end of every line except the last Put “; at the end of the last line Put var XMLRequest = at the very beginning Insert substitution variables Make sure the decisionServiceName is correct Add either decisionServiceVersion or decisionServiceEffectiveDate You should now have something that looks like this: Actually these are the only lines that will need to change in order to invoke a different decision service: " decisionServiceName=\"RollbaseMedicalClaim\" " + " WorkDocuments " + " Claim id=\"Claim_id_1\" " + " amount {!amount} /amount " + " typeOfSurgery {!typeofsurgery} /typeOfSurgery " + " patient {!patient} /patient " + " /Claim " + " /WorkDocuments " + Then you need some code to send this to Corticon and process the response Send the XML request to Corticon var url = "http://localhost:8082/axis/services/Corticon"; /*Corticon URL*/ var params = {"SOAPAction":"http://soap.eclipse.corticon.com","Content-Type":"text/xml"}; var response=rbv_api.sendJSONRequest(url,xmlRequest,"POST","text/xml;charset:UTF8",null,null,params); /* rbv_api.println(response); for debugging */ Process the Response from Corticon var root = rbv_api.parseXML(response); var status = root.getElementsByTagName('ns1:status').item(0).getFirstChild().getNodeValue(); rbv_api.setFieldValue('medicalclaim', {!id}, 'status',status); var message = root.getElementsByTagName('ns1:text').item(0).getFirstChild().getNodeValue(); rbv_api.setFieldValue('medicalclaim', {!id}, 'reason',message); Testing the Javascript The javascript can be tested by using the debug button in the trigger screen: Appendix Sample Javascript for a Corticon Request (Medical Claim example) var xmlRequest= " ?xml version=\"1.0\" encoding=\"UTF-8\"? " + " SOAP-ENV:Envelope" + " xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" " + " xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" " + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " + " SOAP-ENV:Body " + " CorticonRequest " + " xmlns=\"urn:Corticon\" " + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " + " decisionServiceName=\"RollbaseMedicalClaim\" " + " WorkDocuments " + " Claim id=\"Claim_id_1\" " + " amount {!amount} /amount " + " typeOfSurgery {!typeofsurgery} /typeOfSurgery " + " patient {!patient} /patient " + " /Claim " + " /WorkDocuments " + " /CorticonRequest " + " /SOAP-ENV:Body " + " /SOAP-ENV:Envelope "; /* DEFINE PARAMETERS */ var url = "http://localhost:8082/axis/services/Corticon"; /*Corticon URL*/ var params = {"SOAPAction":"http://soap.eclipse.corticon.com","Content-Type":"text/xml"}; /* SEND REQUEST */ var response=rbv_api.sendJSONRequest(url,xmlRequest,"POST","text/xml;charset:UTF8",null,null,params); /* rbv_api.println(response); FOR DEBUGGING */ var root = rbv_api.parseXML(response); /* GET STATUS */ var status = root.getElementsByTagName('ns1:status').item(0).getFirstChild().getNodeValue(); rbv_api.setFieldValue('medicalclaim', {!id}, 'status',status); /* GET MESSAGE */ var message = root.getElementsByTagName('ns1:text').item(0).getFirstChild().getNodeValue(); rbv_api.setFieldValue('medicalclaim', {!id}, 'reason',message);

Continue reading...
 
Status
Not open for further replies.
Top