Blockchain Adapter For Salesforce User Guide Spring2019(V1.1)
User Manual:
Open the PDF directly: View PDF .
Page Count: 23
Download | |
Open PDF In Browser | View PDF |
Blockchain Adapter for Salesforce User Guide for Spring 2019 V 1.1 with an Example Table of Contents Installation ............................................................................................................................. 3 Preparation for Configuration................................................................................................. 4 Preparation in Salesforce (Already done in Test Organization) ......................................................... 4 Voting app – A simple custom object................................................................................................................. 4 Platform Events .................................................................................................................................................. 5 Process Builder ................................................................................................................................................... 5 Enable the Remote Site ...................................................................................................................................... 7 Preparation in Blockchain (Reviewer may execute these steps to perform full functional tests) ....... 8 Deploy Smart contract to Blockchain ................................................................................................................. 8 Adapter Configuration ................................................................................................................... 12 Adapter Runtime – Salesforce to Ethreum Blockchain ........................................................... 17 Save a new Vote ............................................................................................................................................... 17 View Dashboard................................................................................................................................................ 17 Test in Remix..................................................................................................................................................... 18 Adapter Runtime – Ethreum Blockchain to Salesforce ........................................................... 19 Adapter REST Endpoint..................................................................................................................................... 19 Blockchain Event Schema ................................................................................................................................. 19 Congratulations .................................................................................................................... 20 Appendix: Technical Details on Event to Contract Field Mapping .......................................... 21 Installation Prerequisites : Will work in Salesforce Developer Edition and any Org that is Lighting enable and can support Platform Events Ensure you have enable My Domain under Company Settings in Setup. Once the package has completed the installation, go to the App Launcher and pick the Blockchain Adapter Which will look like this if you have the package installed correctly and My Domain configured. This user guide will walk you through the set-up process using an example. As you progress though the document you will also learn about the features of the Adapter. This example will create a Voting app in Salesforce. Let’s say that the app is expected to record every vote and the voter details to blockchain as the vote is cast. Following are the steps to execute in order to use the adapter to integrate your salesforce application with Blockchain. Preparation for Configuration Preparation in Salesforce (Already done in Test Organization) Voting app – A simple custom object In this example we create a simple Custom Object Platform Events This Adapter is entirely platform events driven. To execute our example, we will need a platform event that the adapter should listen to. So, we create a platform event that will trigger when a someone votes for Foo. Note that the event has 2 custom fields Name and Address. At this point just keep in mind that these are the fields that will be written to the blockchain. Process Builder Develop and deploy a process that will trigger the above said event when a vote is cast for Foo. Process Trigger Condition Action Enable the Remote Site In Setup find Remote Site Settings and click New Remote Site Enter the details as follows, most importantly use this URL if you are following this guide. https://ofs-df-blockchain.herokuapp.com/blockchain Preparation in Blockchain (Reviewer may execute these steps to perform full functional tests) You can use any Ethereum Blockchain that allows RPC calls. For the purpose of security review, you use https://ofs-df-blockchain.herokuapp.com/blockchain This is an Ethereum blockchain hosted in Heroku for testing purpose. Deploy Smart contract to Blockchain Deploy the smart contract given below to the blockchain using Remix 1. Launch Remix - https://remix.ethereum.org/ 2. Set up Web3 Provider a. From the Environment drop down select “Web3 Provider” and accept any warnings Enter: https://ofs-df-blockchain.herokuapp.com/blockchain .Then click OK . 3. Copy and paste the Smart Contract given below – Ballot.sol https://github.com/objectfrontiergit/smartContractsForAdapterTest 4. Pick the compiler version to use a. Click on Compile in the top right b. Expand the Select new compiler version and pick the committed version number in the solidity file (in the following image it is version 0.4.21) c. The code will automatically compile and show the current version in the top right 5. Successful Compilation 6. Copy ABI and save it in a file by clicking ABI which will automatically copy the structure to your copy & paste buffer. Then create a file or save the contents somewhere as you will need it in the next section. 7. Deploy Smart Contract 8. Make a note of Contract Id, you can copy it to the clipboard with the icon highlight here in the Deployed Contracts section on the Run tab. You will need this value later. DO NOT CLOSE THIS TAB, you will need it for testing at the end of the document.At this point you are all set to go configure the Adapter. Adapter Configuration **Troubleshooting: if you don’t see the Adapter Configuration but only the “CONFIGURATION” header then you likely have not setup up My Domain, enabled it for all users and logged in using that domain. The URL is: https://ofs-df-blockchain.herokuapp.com/blockchain You can use the Blockchain Test Account Address: 0x79fb532c7949ee7157c6817beaccf3230cea2865 The REF ID will remain blank. Click Save. You will then pick the Smart Contract Function defined in the Solidity code you have placed in ttps://remix.ethereum.org/. For this flow, we will use voteForFoo Adapter Runtime – Salesforce to Ethreum Blockchain Save a new Vote View Dashboard Test in Remix If this is the first call you will be able to go to Deployed Contracts section of the https://remix.ethereum.org/ browser tab you have LEFT OPEN from earlier so it is still pointing at the same contract. This will not work if you have closed the tab. 1) Click to expand the voteDetailsOfFoo section of the Deployed Contract section. 2) Enter the index value you want to retrieve, it is likely 1 if you have followed this exactly but you can try 0, 2 or 3 if you have been playing around a bit. In the image, you can see how many getVoteCounts have been gathered to confirm there is at least some registered. 3) By clicking call you will retrieve the data that shows at the bottom of the screen. Adapter Runtime – Ethreum Blockchain to Salesforce Adapter REST Endpoint The adapter exposes the following REST endpoint An external component/app listening to the Smart contract events can invoke this end point when the Smart contract event happens. This Adapter wndpoint when called will trigger a prepackaged platform event (Blockchain Event) that Salesforce components can listen to and take action. Blockchain Event Schema Congratulations You have now completed a basic call from Salesforce to an Ethereum blockchain. Next step is to capture changes in Ethereum and related that back to Salesforce. You can now edit the Solidity code to create your own logic. Appendix: Technical Details on Event to Contract Field Mapping Note: Validation error will be thrown when the number of fields in the event doesn't match the number of params in the contract function during configuration Runtime exception will be thrown when The number of fields in the events change after theconfiguration. These runtime exceptions will be recorded and reported in the “Recent Transactions”
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf Linearized : No Page Count : 23 PDF Version : 1.4 Title : Microsoft Word - Blockchain Adapter for Salesforce User guide - DTH.docx Producer : macOS Version 10.14.2 (Build 18C54) Quartz PDFContext Creator : Word Create Date : 2019:02:04 21:06:14Z Modify Date : 2019:02:04 21:06:14ZEXIF Metadata provided by EXIF.tools