Import Business Rules From Spreadsheet

Has anyone come across a tool that will create a Process Business Rule from a CSV file?

We are looking to assign Leads based on ZIP Codes and entering thousands of ZIP Codes through the UI will be very time consuming.

  • Hi John,

    First of all, I can tell from your question that you are already aware that the product doesn't do this natively. However, the need to manage large lookup tables for usage in process defs is real, and for that reason, I encourage you to post a request for it here: https://sugarclub.sugarcrm.com/explore/sell/i/product-suggestions. I'd love to see large lookup tables managed in a custom module which a business rule could look up - that way we get the normal import/mass update functions to manage it.

    There are two ways I've come across of dealing with this based upon your risk tolerance / comfort with Excel:

    1. The .pbr file used by the export/import functions in Process Business Rules module are designed to work in a "make a sandbox copy of your whole environment, change+test there, export from sandbox and import to production" style process. There are a range of caveats why this is the only supported process, and the warnings in the system explain why that is so.

      However, if you open up the .pbr file (I would suggest putting in 3 rows of ZipCode-to-LeadAssignee into your business rule and then export it), you'll find that it's an ordinary json object, and all the magic happens in project->rst_source_definition. The structure of this value is well defined, and after some header content, you'll see each line of the business rule in it, along with some content around it.

      This means that if you choose to maintain the mapping of ZIPCode-to-LeadAssignee in an Excel spreadsheet, you can add another column to that sheet which uses CONCAT to format the first two columns and produce a line which would be used inside the rst_source_definition value.

      Then a master CONCAT which joins all of that together with the rest of the content you got from your exported .pbr format.

      This approach isn't for the faint-hearted, and requires you to have very carefully formatted CONCAT statements. If you get it wrong, Sugar will not let you import the file. But at the end of the day, all the effort is done once (to begin with), and thereafter, your maintenance process would be to update the mappings in your spreadsheet, and then do a big copy and paste (probably from a second sheet) into a .pbr file for importing.

    2. A potentially simpler option revolves around the same principle, but using a dropdown list as a proxy. I've used this one specifically for lead routing based on postcodes, but as I'm from Australia, I only had several hundred rows to deal with .. not sure how it'll go with thousands Slight smile

      In this case, you maintain your mapping in a spreadsheet, use a simpler CONCAT in Excel to create what each row of the dropdown list looks like, and use your favourite means to get that into a language file in Sugar.

      A custom text field uses SugarLogic to lookup the Lead Assignee via the getDropdownValue function (with the zip code as a key), then your business rule just uses the data in this custom field to set the native Assigned To.

    Hope this helps as a starting point!

  • I was wondering if this is still the only method or any other ideas like an API import script?

    .

    CRM Business Consultant

  • A very simple business rule like the example USA Regions rule is saved in the database with this record:

    "SELECT id, name, date_entered, date_modified, modified_user_id, created_by, description, deleted, rst_uid, rst_type, rst_definition, rst_editable, rst_source, rst_source_definition, rst_module, rst_filename, rst_create_date, rst_update_date, sync_key, team_id, team_set_id, acl_team_set_id, assigned_user_id\nFROM sugardev1310.pmse_business_rules": [
    	{
    		"id" : "88c0e4ba-d038-11e9-8175-269099cc8e72",
    		"name" : "USA Regions",
    		"date_entered" : "2024-01-28 09:25:29",
    		"date_modified" : "2024-01-28 09:25:29",
    		"modified_user_id" : "1",
    		"created_by" : "1",
    		"description" : "USA territory assignment rules.",
    		"deleted" : 0,
    		"rst_uid" : null,
    		"rst_type" : "single",
    		"rst_definition" : null,
    		"rst_editable" : 0,
    		"rst_source" : null,
    		"rst_source_definition" : "{\"base_module\":\"Leads\",\"type\":\"single\",\"columns\":{\"conditions\":[{\"module\":\"Leads\",\"field\":\"primary_address_state\"}],\"conclusions\":[\"\"]},\"ruleset\":[{\"id\":1,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"WA\\\"\",\"expValue\":\"WA\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NW\\\"\",\"expValue\":\"NW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":2,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"OR\\\"\",\"expValue\":\"OR\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NW\\\"\",\"expValue\":\"NW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":3,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"ID\\\"\",\"expValue\":\"ID\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NW\\\"\",\"expValue\":\"NW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":4,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MT\\\"\",\"expValue\":\"MT\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NW\\\"\",\"expValue\":\"NW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":5,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"WY\\\"\",\"expValue\":\"WY\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NW\\\"\",\"expValue\":\"NW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":6,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"CA\\\"\",\"expValue\":\"CA\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"W\\\"\",\"expValue\":\"W\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":7,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NV\\\"\",\"expValue\":\"NV\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"W\\\"\",\"expValue\":\"W\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":8,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"UT\\\"\",\"expValue\":\"UT\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"W\\\"\",\"expValue\":\"W\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":9,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"CO\\\"\",\"expValue\":\"CO\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"W\\\"\",\"expValue\":\"W\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":10,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"WY\\\"\",\"expValue\":\"WY\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"W\\\"\",\"expValue\":\"W\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":11,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"AZ\\\"\",\"expValue\":\"AZ\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"SW\\\"\",\"expValue\":\"SW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":12,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NM\\\"\",\"expValue\":\"NM\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"SW\\\"\",\"expValue\":\"SW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":13,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"TX\\\"\",\"expValue\":\"TX\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"SW\\\"\",\"expValue\":\"SW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":14,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"OK\\\"\",\"expValue\":\"OK\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"SW\\\"\",\"expValue\":\"SW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":15,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"AR\\\"\",\"expValue\":\"AR\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"SW\\\"\",\"expValue\":\"SW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":16,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"LA\\\"\",\"expValue\":\"LA\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"SW\\\"\",\"expValue\":\"SW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":17,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"ND\\\"\",\"expValue\":\"ND\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MW\\\"\",\"expValue\":\"MW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":18,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"SD\\\"\",\"expValue\":\"SD\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MW\\\"\",\"expValue\":\"MW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":19,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NE\\\"\",\"expValue\":\"NE\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MW\\\"\",\"expValue\":\"MW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":20,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"KS\\\"\",\"expValue\":\"KS\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MW\\\"\",\"expValue\":\"MW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":21,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MN\\\"\",\"expValue\":\"MN\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MW\\\"\",\"expValue\":\"MW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":22,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"IA\\\"\",\"expValue\":\"IA\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MW\\\"\",\"expValue\":\"MW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":23,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MO\\\"\",\"expValue\":\"MO\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MW\\\"\",\"expValue\":\"MW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":24,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"WI\\\"\",\"expValue\":\"WI\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MW\\\"\",\"expValue\":\"MW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":25,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"IL\\\"\",\"expValue\":\"IL\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MW\\\"\",\"expValue\":\"MW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":26,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"IN\\\"\",\"expValue\":\"IN\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MW\\\"\",\"expValue\":\"MW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":27,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MI\\\"\",\"expValue\":\"MI\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MW\\\"\",\"expValue\":\"MW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":28,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"OH\\\"\",\"expValue\":\"OH\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MW\\\"\",\"expValue\":\"MW\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":29,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MS\\\"\",\"expValue\":\"MS\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"S\\\"\",\"expValue\":\"S\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":30,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"AL\\\"\",\"expValue\":\"AL\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"S\\\"\",\"expValue\":\"S\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":31,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"TN\\\"\",\"expValue\":\"TN\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"S\\\"\",\"expValue\":\"S\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":32,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"KY\\\"\",\"expValue\":\"KY\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"S\\\"\",\"expValue\":\"S\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":33,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"GA\\\"\",\"expValue\":\"GA\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"S\\\"\",\"expValue\":\"S\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":34,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"FL\\\"\",\"expValue\":\"FL\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"S\\\"\",\"expValue\":\"S\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":35,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NC\\\"\",\"expValue\":\"NC\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"S\\\"\",\"expValue\":\"S\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":36,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"SC\\\"\",\"expValue\":\"SC\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"S\\\"\",\"expValue\":\"S\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":37,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"WV\\\"\",\"expValue\":\"WV\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"S\\\"\",\"expValue\":\"S\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":38,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"VA\\\"\",\"expValue\":\"VA\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"S\\\"\",\"expValue\":\"S\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":39,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MD\\\"\",\"expValue\":\"MD\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"S\\\"\",\"expValue\":\"S\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":40,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"DE\\\"\",\"expValue\":\"DE\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"S\\\"\",\"expValue\":\"S\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":41,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"PA\\\"\",\"expValue\":\"PA\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NE\\\"\",\"expValue\":\"NE\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":42,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NY\\\"\",\"expValue\":\"NY\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NE\\\"\",\"expValue\":\"NE\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":43,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NJ\\\"\",\"expValue\":\"NJ\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NE\\\"\",\"expValue\":\"NE\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":44,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"CT\\\"\",\"expValue\":\"CT\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NE\\\"\",\"expValue\":\"NE\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":45,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"RI\\\"\",\"expValue\":\"RI\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NE\\\"\",\"expValue\":\"NE\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":46,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"MA\\\"\",\"expValue\":\"MA\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NE\\\"\",\"expValue\":\"NE\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":47,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"VT\\\"\",\"expValue\":\"VT\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NE\\\"\",\"expValue\":\"NE\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":48,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NH\\\"\",\"expValue\":\"NH\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NE\\\"\",\"expValue\":\"NE\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":49,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"ME\\\"\",\"expValue\":\"ME\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NE\\\"\",\"expValue\":\"NE\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":50,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"AK\\\"\",\"expValue\":\"AK\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"NE\\\"\",\"expValue\":\"NE\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]},{\"id\":51,\"conditions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"\\\"\",\"expValue\":\"\"}],\"variable_name\":\"primary_address_state\",\"condition\":\"==\",\"variable_module\":\"Leads\"}],\"conclusions\":[{\"value\":[{\"expType\":\"CONSTANT\",\"expSubtype\":\"string\",\"expLabel\":\"\\\"FALSE\\\"\",\"expValue\":\"FALSE\"}],\"conclusion_value\":\"result\",\"conclusion_type\":\"return\"}]}]}",
    		"rst_module" : "Leads",
    		"rst_filename" : null,
    		"rst_create_date" : null,
    		"rst_update_date" : null,
    		"sync_key" : null,
    		"team_id" : "1",
    		"team_set_id" : "1",
    		"acl_team_set_id" : null,
    		"assigned_user_id" : "1"
    	}
    ]

    If you encode the field rst_source_definition which contains the business rule definition you get the following JSON encoded tree:

    {
        "base_module": "Leads",
        "type": "single",
        "columns": {
            "conditions": [{
                    "module": "Leads",
                    "field": "primary_address_state"
                }
            ],
            "conclusions": [""]
        },
        "ruleset": [{
                "id": 1,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"WA\"",
                                "expValue": "WA"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NW\"",
                                "expValue": "NW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 2,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"OR\"",
                                "expValue": "OR"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NW\"",
                                "expValue": "NW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 3,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"ID\"",
                                "expValue": "ID"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NW\"",
                                "expValue": "NW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 4,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MT\"",
                                "expValue": "MT"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NW\"",
                                "expValue": "NW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 5,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"WY\"",
                                "expValue": "WY"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NW\"",
                                "expValue": "NW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 6,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"CA\"",
                                "expValue": "CA"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"W\"",
                                "expValue": "W"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 7,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NV\"",
                                "expValue": "NV"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"W\"",
                                "expValue": "W"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 8,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"UT\"",
                                "expValue": "UT"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"W\"",
                                "expValue": "W"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 9,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"CO\"",
                                "expValue": "CO"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"W\"",
                                "expValue": "W"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 10,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"WY\"",
                                "expValue": "WY"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"W\"",
                                "expValue": "W"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 11,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"AZ\"",
                                "expValue": "AZ"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"SW\"",
                                "expValue": "SW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 12,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NM\"",
                                "expValue": "NM"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"SW\"",
                                "expValue": "SW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 13,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"TX\"",
                                "expValue": "TX"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"SW\"",
                                "expValue": "SW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 14,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"OK\"",
                                "expValue": "OK"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"SW\"",
                                "expValue": "SW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 15,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"AR\"",
                                "expValue": "AR"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"SW\"",
                                "expValue": "SW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 16,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"LA\"",
                                "expValue": "LA"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"SW\"",
                                "expValue": "SW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 17,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"ND\"",
                                "expValue": "ND"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MW\"",
                                "expValue": "MW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 18,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"SD\"",
                                "expValue": "SD"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MW\"",
                                "expValue": "MW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 19,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NE\"",
                                "expValue": "NE"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MW\"",
                                "expValue": "MW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 20,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"KS\"",
                                "expValue": "KS"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MW\"",
                                "expValue": "MW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 21,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MN\"",
                                "expValue": "MN"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MW\"",
                                "expValue": "MW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 22,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"IA\"",
                                "expValue": "IA"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MW\"",
                                "expValue": "MW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 23,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MO\"",
                                "expValue": "MO"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MW\"",
                                "expValue": "MW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 24,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"WI\"",
                                "expValue": "WI"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MW\"",
                                "expValue": "MW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 25,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"IL\"",
                                "expValue": "IL"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MW\"",
                                "expValue": "MW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 26,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"IN\"",
                                "expValue": "IN"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MW\"",
                                "expValue": "MW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 27,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MI\"",
                                "expValue": "MI"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MW\"",
                                "expValue": "MW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 28,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"OH\"",
                                "expValue": "OH"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MW\"",
                                "expValue": "MW"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 29,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MS\"",
                                "expValue": "MS"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"S\"",
                                "expValue": "S"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 30,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"AL\"",
                                "expValue": "AL"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"S\"",
                                "expValue": "S"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 31,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"TN\"",
                                "expValue": "TN"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"S\"",
                                "expValue": "S"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 32,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"KY\"",
                                "expValue": "KY"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"S\"",
                                "expValue": "S"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 33,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"GA\"",
                                "expValue": "GA"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"S\"",
                                "expValue": "S"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 34,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"FL\"",
                                "expValue": "FL"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"S\"",
                                "expValue": "S"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 35,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NC\"",
                                "expValue": "NC"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"S\"",
                                "expValue": "S"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 36,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"SC\"",
                                "expValue": "SC"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"S\"",
                                "expValue": "S"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 37,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"WV\"",
                                "expValue": "WV"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"S\"",
                                "expValue": "S"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 38,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"VA\"",
                                "expValue": "VA"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"S\"",
                                "expValue": "S"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 39,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MD\"",
                                "expValue": "MD"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"S\"",
                                "expValue": "S"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 40,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"DE\"",
                                "expValue": "DE"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"S\"",
                                "expValue": "S"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 41,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"PA\"",
                                "expValue": "PA"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NE\"",
                                "expValue": "NE"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 42,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NY\"",
                                "expValue": "NY"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NE\"",
                                "expValue": "NE"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 43,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NJ\"",
                                "expValue": "NJ"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NE\"",
                                "expValue": "NE"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 44,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"CT\"",
                                "expValue": "CT"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NE\"",
                                "expValue": "NE"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 45,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"RI\"",
                                "expValue": "RI"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NE\"",
                                "expValue": "NE"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 46,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"MA\"",
                                "expValue": "MA"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NE\"",
                                "expValue": "NE"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 47,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"VT\"",
                                "expValue": "VT"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NE\"",
                                "expValue": "NE"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 48,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NH\"",
                                "expValue": "NH"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NE\"",
                                "expValue": "NE"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 49,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"ME\"",
                                "expValue": "ME"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NE\"",
                                "expValue": "NE"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 50,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"AK\"",
                                "expValue": "AK"
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"NE\"",
                                "expValue": "NE"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }, {
                "id": 51,
                "conditions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"\"",
                                "expValue": ""
                            }
                        ],
                        "variable_name": "primary_address_state",
                        "condition": "==",
                        "variable_module": "Leads"
                    }
                ],
                "conclusions": [{
                        "value": [{
                                "expType": "CONSTANT",
                                "expSubtype": "string",
                                "expLabel": "\"FALSE\"",
                                "expValue": "FALSE"
                            }
                        ],
                        "conclusion_value": "result",
                        "conclusion_type": "return"
                    }
                ]
            }
        ]
    }
    

    This single record contains so much information that a simple csv file is surely not the rigth place the handle it.

    It is another side of the coin when you decide to define an own csv syntax which is handled perhaps by an own module, eg.g custom_busines_rules.

    Here you could create all the rule lines in a certain structure and create a summarizing business rule on demand by a button click. But that's custom coding and should be done in this special custom module, for which an import would be available also.