0

I have a generic JSON string containing bunch on arrays. This list can grow in future and can have n-number of repeating elements.

For ex:

  "parent_node": {
    "node_1": {
      "a": "1",
      "b": "2"
    },
    "node_2": {
      "a": "1",
      "b": "2"
    },
    "node_3": {
      "a": "1",
      "b": "2"
    }
  }

I can easily use static resource, but maintenance becomes a problem. My idea is to provide user friendly customization. Using JSON would be much easier for me but my salesforce users are not aware of JSON and that adds a dependency for them to learn to build a valid JSON file.

I am trying to use custom settings, but doesn't seems to be much helpful. My idea is to accommodate all future enhancements without modifying APEX code and every new addition of child elements or even parent elements must be configurable.

Emre Bolat
  • 4,316
  • 5
  • 29
  • 32
blue
  • 13
  • 3

1 Answers1

0

Take in count that a custom setting is the equivalent to a table on a relational database, so you cannot use "document base" representations.

If the fields on the nodes are fixed, you could use custom settings for that, per example the previous json structure could be represented as a custom setting like:

|parent node | node | a | b | |------------------------------| |parent node x | node1 | 1 | 2 | |parent node x | node2 | 1 | 2 | |parent node x | node3 | 1 | 2 | |parent node x | node4 | 1 | 2 |

A few considerations:

  • Make the custom setting type "List".
  • visibility "Public"
Cloxure
  • 1,799
  • 1
  • 14
  • 15
  • Thanks for the response Cloxure. I understand that part and trying to figure out if there is anyway that I can solution this without using JSON file in static resources. – blue Jul 12 '16 at 22:22
  • mmmm, with the https://help.salesforce.com/apex/HTViewHelpDoc?id=cs_about.htm, an admin could update it any time. – Cloxure Jul 13 '16 at 02:00