Occasionally business requirements may require responses in Wizards to be auto-populated when the Wizard is first launched. Circumstances may dictate that fields for a particular Wizard are always populated for reasons such as the following:

  • Object field values for the Wizard should always be the same (e.g., an Agreement-creation Wizard that will always have the same Account and Opportunity names filled in for certain steps).
  • Wizard Input or Object Field values should always match every new Wizard of the same design (e.g., multiple surveys/questionnaires for each line item in a Cart line that should share the same responses based on a previously completed survey).

There are two primary methods provided in Wizard Design for auto-populating fields during Wizard runtime:

  • passing record IDs as parameters when the Wizard launches to auto-populate Object fields.
  • implementing a special DataSource callback class that fetches data from one runtime Wizard to populate other Wizards of the same design.

Note that while the above functionality exists out-of-the-box, use of this feature requires a custom implementation for initiating auto-populated Wizards. Also note that compound and read-only fields cannot be auto-populated at this time.

Auto-populating Wizard Fields using Record ID

To auto-populate fields based on record ID(s) every time a new instance of the Wizard is launched, you need to pass Object record Ids as parameters when the Wizard is launched. In most cases, this implementation will use something like a formula field, which captures the desired record IDs and includes them in the URL when the Wizard is first launched.

Consider a simple agreement creation Wizard. Your requirement include auto-populating the initial steps of the Wizard with details from the associated Account and Opportunity, which will be the same for every instance of the Wizard. Rather than having the Wizard user enter these values every time the Wizard is run, you want them to be automatically filled when the Wizard is launched.

  • To use this method, the inputs you want to be auto-populated must be Object fields that match the types of records you are passing as parameters. In this example, the designer creates an input for Account > Account Name.
  • In the next step, the designer creates an input for Opportunity > Name.
  • As these are pre-existing objects in the same org, it's easy to retrieve record IDs to pass to the Wizard when it is launched. How the record IDs are passed to the Wizard depends on your integration with Conga CLM Wizard. Record IDs could be passed as parameters using a formula field, for instance.

When the Wizard is first launched through your integration, the URL is constructed in this fashion:

https://apttus-wizard.na34.visual.force.com/apex/apttus_wizard__wizard?wizardid=a11610000016K6fAAE

where "wizardid=a11610000016K6fAAE" is passing the Id of the runtime wizard. Your solution should append recordIDs corresponding to the Object where the fields reside and which match the Object of the fields you want to auto-populate.

Returning to the above example, you can auto-populate fields in the Wizard using specific Account and Opportunity record IDs. To see this in action:

  1. Go to the Wizards tab and launch the Wizard you want to auto-populate. Note the Wizard runtime URL.
  2. Open another tab and go to the Account which contains the data you want to capture. Copy the Account Record ID from the URL.
  3. Return to the Wizard runtime and append the URL with the Account Record ID, using proper syntax to pass it as a parameter (e.g. "&recordIds={Account_Id}).
  4. Repeat steps 2-3 for the Account Opportunity. Comma-separate multiple record IDs.
  5. Press Enter. Fields which have values on the Objects corresponding to the record IDs you passed will be automatically populated with data across multiple steps, wherever they appear in the Wizard.
  6. Follow this format for your integrations. Using this method, you can easily construct a formula field to pass these parameters from your Wizard launch point and auto-populate data for your users.

Auto-populating Wizard Fields using a Datasource Callback

When you need to build the ability to auto-populate fields in Wizards based on previously entered responses for your integration, you should use the Datasource Callback method. This method also requires passing data to the Wizard as in the previous section, but in this case it is retrieving data from one completed Wizard and using that data to populate newly-invoked Wizards that use the same design.

Wizard Runtime JSON Structure

To properly understand the format of the data returned by the callback to auto-populate a Wizard, let's take a look at a sample JSON structure created from a Wizard step with 2 responses:

Sample JSON: Auto-Populate

{
       "UserResponses": [{
              "Question": "sample question - 1",
              "ObjectName": null,
              "Notes": [],
              "metaPropertyFields": null,
              "inputRepeatSequence": 0,
              "inputControlId": "a0236000002LNlDAAW",
              "FieldName": null,
              "FieldClass": null,
              "Comments": "",
              "Attachments": [],
              "Answer": "sample answer - 1"
       }, {
              "Question": "sample question - 2",
              "ObjectName": null,
              "Notes": [],
              "metaPropertyFields": null,
              "inputRepeatSequence": 0,
              "inputControlId": "a0236000002LNlEAAW",
              "FieldName": null,
              "FieldClass": null,
              "Comments": "",
              "Attachments": [],
              "Answer": "sample answer - 2"
       }],
       "Parameters": null
}
CODE

When using the callback method to auto-populate fields in a runtime Wizard, the method should return a string using a similar JSON structure as shown in the example above. The values in the JSON string auto-populate the fields when the Wizard is invoked.

The parameters described in the following table are relevant for Callback implementations to auto-populate questions/responses in the Wizard:

ParameterValueDescription
QuestionObject/Wizard Input field nameProvide the name of the field in the Input Control as defined (e.g., "AccountName" or "OppName")
inputControlIdId string of Input ControlProvide the Id string of the input control to be auto-populated (e.g., "a1561000001dXHf")
AnswerField or Response valueProvide the value to auto-populated as in the Wizard field/response (e.g. "Tier One Systems")
inputRepeatSequenceNumeric sequence for repeatable Wizard Input ControlsIf the Wizard step uses a "Repeatable" layout for an input, Provide a numeric value to represent each occurrence (e.g., first occurrence is "inputRepeatSequence:" 0, next occurrence is "InputRepeatSequence:"1, etc.)

Implementing a Datasource Callback

The data captured from the previously completed wizard can be from Wizard Input Fields or Object fields. For your integration, you must create a DataSource Callback class that passes this retrieved data to the new Wizard runtime instance. The process works as follows:

  • A custom Data Source callback class is created to implement the DataSource Callback interface WizardCustomClass.IDataSourceCallback.
  • The DataSource Callback class calls a custom getData() method that takes the Wizard Design ID as the primary parameter and a map of parameters passed to the Wizard design.
  • The getData() method is used to define values for specific runtime input controls in the Wizard design (questions, answers and values) and creates and returns a JSON string using the same structure interpreted by the Wizard.
  • The Wizard Design using the DataSource Callback must have the class name defined in the Wizard Settings section of the Wizard Design.
  • When a new Wizard is invoked, fields specified by the Callback method are auto-populated.