Jump to content

LogIncident - questions string format


Recommended Posts

In the API call LogIncident, there is a string parameter 'questions' but we cannot find any further information on the syntax of this string parameter on how to pass and delimiter individual questions and answers.

Has anyone got any  more details or examples for populating this parameter?

Cheers

Martyn

Link to comment
Share on other sites

Guest Ehsan

Hi @Martyn Houghton,

The questions parameter should be set with a JSON object containing the questions and answers for each custom form in Progressive Capture.

Below is an example where I have one custom form with two questions in my Incident flow.

image.png

The JSON object below is generated by the Progressive Capture engine after I have completed the questions on the custom form.

[minus.gif
   {minus.gif
      "form_id": "Details",
      "question": "Extended Summary",
      "question_id": "h_summary",
      "answer": "Here's my extended summary",
      "answer_value": "Here's my extended summary",
      "field_type": "textarea",
      "entity_type": "request",
      "hbfield": {minus.gif
         "question": "Extended Summary",
         "field": {minus.gif
            "id": "h_summary",
            "defLabel": "Extended Summary",
            "transLabel": "x",
            "noInvisibleValue": false,
            "binding": "global.Details.h_summary",
            "design": {minus.gif
               "isVisible": true,
               "isMandatory": false,
               "isReadOnly": false,
               "showIfEmpty": false
            },
            "control": {minus.gif
               "extraClass": "",
               "type": "textarea"
            },
            "originalPosition": {minus.gif
               "sectionName": "questions",
               "rowPos": 0,
               "colPos": 0,
               "fieldPos": 0
            },
            "value": "Here's my extended summary"
         },
         "value": "Here's my extended summary"
      }
   },
   {minus.gif
      "form_id": "Details",
      "question": "Extended Description",
      "question_id": "h_description",
      "answer": "1867",
      "answer_value": "1867",
      "field_type": "queryselect",
      "entity_type": "request",
      "hbfield": {minus.gif
         "question": "Extended Description",
         "field": {minus.gif
            "id": "h_description",
            "defLabel": "Extended Description",
            "transLabel": "x",
            "noInvisibleValue": false,
            "binding": "global.Details.h_description",
            "design": {minus.gif
               "isVisible": true,
               "isMandatory": false,
               "isReadOnly": false,
               "showIfEmpty": false
            },
            "control": {minus.gif
               "extraClass": "",
               "type": "queryselect",
               "dataprovider": "getAssetsListForPC",
               "dataproviderAppName": "com.hornbill.servicemanager",
               "dataproviderIsStoredQuery": true,
               "dataproviderType": "query",
               "dataproviderSortBy": "itemName",
               "dataproviderSortDir": "ascending",
               "dataproviderParams": [minus.gif
                  {},
                  {},
                  {minus.gif
                     "classId": "Software"
                  }
               ],
               "dataproviderValueField": "id",
               "dataproviderTextField": "text",
               "dataproviderQueryParam": "filter",
               "dataproviderLookupParam": "assetId",
               "options": [minus.gif
                  {minus.gif
                     "value": "Office 365",
                     "text": "Office 365",
                     "id": "1867"
                  }
               ],
               "selectedItem": {minus.gif
                  "value": "1867",
                  "text": "Office 365",
                  "id": "1867"
               }
            },
            "originalPosition": {minus.gif
               "sectionName": "questions",
               "rowPos": 0,
               "colPos": 0,
               "fieldPos": 1
            },
            "value": "1867",
            "valueName": "Office 365",
         },
         "value": "1867",
         "valueName": "Office 365"
      }
   }
]

The Progressive Capture engine processes complex forms and generates a JSON object following the user's interaction with the provided user-interface while raising a Request. It would be important to understand whether you plan to provide a similar interface? If your intention is to populate custom fields in a Request, I would suggest that you set the questionsMapCustomFields parameter instead.

Below is an example.

{
	"h_custom_a": "Custom Field A Value",
	"h_custom_b": "Custom Field B Value",
	"h_custom_c": "Custom Field C Value",
	"h_site": "London",
	"h_site_id": 124	
}

Ehsan

Link to comment
Share on other sites

@Ehsan

We do intend to allow customers to log requests for the Customer Portal using a Progressive Capture as well, hence why we want to populate Question section with information.

We already use most of our custom fields for other values populated during the workflow process which is why we want to pass this information in the Question section.

So I I am understanding things correctly the question string will be a JSON formatted string. What is the minimum syntax required to pass values?

[minus.gif
   {minus.gif
      "form_id": "Details",
      "question": "Extended Summary",
      "question_id": "h_summary",
      "answer": "Here's my extended summary",
      "answer_value": "Here's my extended summary",
      "field_type": "textarea",
      "entity_type": "request",
      }
   },
   {minus.gif
      "form_id": "Details",
      "question": "Extended Description",
      "question_id": "h_description",
      "answer": "1867",
      "answer_value": "1867",
      "field_type": "queryselect",
      "entity_type": "request",
   }
]

Cheers

Martyn

Link to comment
Share on other sites

Guest Ehsan

@Martyn Houghton,

The minimum required is as per the example I provided. The values are used by the Request logging process (front-end and back-end) to determine how the information is processed and presented in the Questions section.

To help you generate and use the configuration required for a Progressive Capture on your instance, I would suggest you take the steps below.

  • Open the Chrome Console (Press F12 on your keyboard) > Click on  the "Network" tab
  • Raise a Request via the Customer Portal for the service and catalog item that you're designing the process for
  • Look for and click on "?method=selfserviceLogIncident" API in the Console's Network tab once you've pressed "Finish" at the end of the Progressive Capture flow
  • Take a look at the Request Payload section in the Headers tab
  •  In the XML, find the "questions" parameter; this should include the configuration that you need

image.png

Ehsan

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...