HomeGuidesDeveloper HubRelease Notes
Get supportBook a chat
Developer Hub
These docs are for v2.134. Click to read the latest docs for v2.208.

Extending a Form

Overview

Do you need to add additional fields in a form? You have the ability to extend a form by adding a JSON static resource.

What is JSON?

If you are new to using JSON or need to brush up on it, feel free to visit W3schools to get a general overview of it.

Extend a form

You can extend a form by adding new sections that contain the fields you wish to include. The form will automatically get field information from Salesforce metadata - such as, label, help text, permissions, etc.

Forms recommended to be extended

FormStatic Resource Name
New / Edit IncentivesincentivesForm_extended
New / Edit RulerulesForm_extended
New / Edit MissionformMissionRule_extended
New / Edit MemberformMember_extended

Steps to extend a form

  1. Create a JSON file that extends the form with the intended fields. The file's name must be the same as the resource's.
  2. Upload that file to a new Static Resource. The name should follow the naming convention provided in the table above and the Cache Control can be private or public - it doesn't make a difference from Fielo's perspective.
  3. Reload the form. Extended file should appear.
📘

Resource Name

You can check the resource's name by looking at the final portion of the form's URL. For example, when you open the New Member form in Fielo, its URL will look like this: https://yourinstance.force.com/lightning/cmp/FieloPLT__BeFormMember

JSON structure

Below is an example of what the JSON would look like to extend an Incentive form, adding a field that will be visible only on Challenges.

[{
    "version": "1.0.0",
    "app": "Client",
    "visibility": {
      "FieloPLT__Promotion__c":{
        "sectionToHide": ["challengeExtended"]
      },
      "FieloPLT__Challenge__c":{
        "sectionToShow": ["challengeExtended"]
      }
     },
    "steps": [{
      "sections": [{
        "auraId": "challengeExtended",
        "title": "$Label.FieloPLT.BasicInf",
        "description": "Incentives extensibility",
        "rows": [{
          "items": [{
            "name": "FieloPLT:BeInput",
            "typeAttributes": {
                "object": "FieloPLT__Challenge__c",
                "fieldName": "MyCustomField",
                "initialValue": "My default value"
            }
          }]
        }]
      }]
    }]
   }]

Note that, in case you want to add more than one field to the form, the "items" section of the JSON should look like the example below. Keep reading to see the breakdown of what each section means.

"items": [{
               "typeAttributes": {
                   "fieldName": "Partner_type__c"
               }
          },{
               "typeAttributes": {
                   "fieldName": "Engagement_model__c"
               }
          }, {
               "typeAttributes": {
                   "fieldName": "Region__c"
               }
          }]

Breaking down the JSON structure

"version":"1.0.0" - Anything in the " " is a string and represents the version of the extended JSON and it allows the system to check compatibility with the form that we are extending. Now it should start with 1.x.x (x should be replaced with a number).

"app":"Client" - Anything in the " " is a string and represents the extension.

"visibility":{ } - It defines whether the new field's section should be displayed in the Promotion and/or Challenge forms. Use "sectionToHide" and "sectionToShow" along with the auraId defined in the section. You can remove visibility from the JSON if not modifying an Incentive form.

"steps":[ ] - Anything in the [ ] is a list containing objects. Each object represents a single step and each step has a sections property. An empty step could be created just to be able to define the following one.

"sections":[ ] Anything in the [ ] is a list containing objects. Property of type List containing objects. Each object represents a single section and each step has a sections. A section can contain a title, a description and row(s).

"auraId":"MyCustomsection" - Anything in the " " is a string and is the value of the section's auraId where visibility will act. You can remove auraId from the JSON if not modifying an Incentive form.

"title":"My Custom section" - Anything in the " " is a string and is the value of the title. The value can also be a custom label as well. The way to use a custom label is “$Label.c.NameOfTheLabel” where .c. is “c” if it is a unpackaged label. Otherwise, the “c” should be the prefix of the package to use a package label.

"description":"My custom Description for demo" - Anything in the " " is a string and is the value of the title. The value can also be a custom label as well. The way to use a custom label is "$Label.c.NameOfTheLabel” where .c. is “c” if it is a unpackaged label. Otherwise, the “c” should be the prefix of the package to use a package label.

"rows":[ ] The [ ] indicates this is a list and will contain objects. Each object represents a single row. Each row will contain items properties.

"items":[ ] The [ ] indicates this is a list and will contain objects. Each object within this list represents a single item (field). Each item has a typeAttributes property.

"name":"FieloPLT:BeInput" - It defines the type of component that you'll add to the form. By default, it is BeInput.

"typeAttributes":{ } - The indicates this is an object. This object contains the necessary properties for the field to be visualized correctly.

"object":"FieloPLT__Object__c" - Anything in the " " is a string and will belong to the typeAttributes. This string value should be the API name of the affected object. If extending an Incentive form, define the object where you want the field to appear (Challenge or Promotion).

"fieldName":"FieloPLT__Field_extended__c" - Anything in the " " is a string and will belong to the typeAttributes. This string value should be the API name of the field.