Jump to content

Example JSON string for questions parameter in ServiceRequests/logServiceRequest method


Recommended Posts

The above has an example of the JSON string for the questions param for having a field of type radioset with two options, and for when Option 2 has been selected during PC, where can I find an example for a single and multiline textbox, rather than a radioset?

Link to comment
Share on other sites

@Rob Gething

For a custom form with two fields (having the default configuration): Field 1 with id "field_1" of type "text" that has the answer (value) of "123" and Field 2 with id "field_2" of type "multi text" that has the answer (value) of "456".

[{"form_id":"form_1","question":"Field 1","question_id":"field_1","answer":"123","answer_value":"123","field_type":"text","entity_type":"request","hbfield":{"question":"Field 1","field":{"id":"field_1","defLabel":"Field 1","transLabel":"x","binding":"global.form_1.field_1","noInvisibleValue":false,"design":{"isVisible":true,"isMandatory":false,"isReadOnly":false,"showIfEmpty":false,"extraClass":" "},"control":{"type":"text"},"uid":"field-1-1"},"value":"123"}},{"form_id":"form_1","question":"Field 2","question_id":"field_2","answer":"456","answer_value":"456","field_type":"textarea","entity_type":"request","hbfield":{"question":"Field 2","field":{"id":"field_2","defLabel":"Field 2","transLabel":"x","binding":"global.form_1.field_2","noInvisibleValue":false,"design":{"isVisible":true,"isMandatory":false,"isReadOnly":false,"showIfEmpty":false,"extraClass":" "},"control":{"type":"textarea"},"uid":"field-2-2"},"value":"456"}}]

 

Link to comment
Share on other sites

@Victor,

The use case here is that I am trying to use Power Automate flow to parse responses from MS Forms to Hornbill via the API to log a service request.

I'm using a Parse JSON node with the following body:

{
  "form_id""RGETHMSFormsTest",
  "question""Test 1",
  "question_id""RGETHMSFormsTest1",
  "answer""CCC",
  "answer_value""CCC",
  "field_type""text",
  "entity_type""request",
  "hbfield": {
    "question""Test 1",
    "field": {
      "id""RGETHMSFormsTest1",
      "defLabel""Test 1",
      "transLabel""x",
      "binding""global.RGETHMSFormsTest.RGETHMSFormsTest1",
      "noInvisibleValue"false,
      "design": {
        "isVisible"true,
        "isMandatory"false,
        "isReadOnly"false,
        "showIfEmpty"false,
        "extraClass"" "
      },
      "control": {
        "type""text"
      },
      "uid""RGETHMSFormsTest-1-1"
    },
    "value""CCC"
  }
}
 
Schema:
 
{
  "type""object",
  "properties": {
    "form_id": {
      "type""string"
    },
    "question": {
      "type""string"
    },
    "question_id": {
      "type""string"
    },
    "answer": {
      "type""string"
    },
    "answer_value": {
      "type""string"
    },
    "field_type": {
      "type""string"
    },
    "entity_type": {
      "type""string"
    },
    "hbfield": {
      "type""object",
      "properties": {
        "question": {
          "type""string"
        },
        "field": {
          "type""object",
          "properties": {
            "id": {
              "type""string"
            },
            "defLabel": {
              "type""string"
            },
            "transLabel": {
              "type""string"
            },
            "binding": {
              "type""string"
            },
            "noInvisibleValue": {
              "type""boolean"
            },
            "design": {
              "type""object",
              "properties": {
                "isVisible": {
                  "type""boolean"
                },
                "isMandatory": {
                  "type""boolean"
                },
                "isReadOnly": {
                  "type""boolean"
                },
                "showIfEmpty": {
                  "type""boolean"
                },
                "extraClass": {
                  "type""string"
                }
              }
            },
            "control": {
              "type""object",
              "properties": {
                "type": {
                  "type""string"
                }
              }
            },
            "uid": {
              "type""string"
            }
          }
        },
        "value": {
          "type""string"
        }
      }
    }
  }
}
 
HTTP node body:
 
{
  "methodCall": {
    "params": {
      "requestType""Service Request",
      "questions""{\"form_id\":\"RGETHMSFormsTest\",\"question\":\"Test 1\",\"question_id\":\"RGETHMSFormsTest1\",\"answer\":\"CCC\",\"answer_value\":\"CCC\",\"field_type\":\"text\",\"entity_type\":\"request\",\"hbfield\":{\"question\":\"Test 1\",\"field\":{\"id\":\"RGETHMSFormsTest1\",\"defLabel\":\"Test 1\",\"transLabel\":\"x\",\"binding\":\"global.RGETHMSFormsTest.RGETHMSFormsTest1\",\"noInvisibleValue\":false,\"design\":{\"isVisible\":true,\"isMandatory\":false,\"isReadOnly\":false,\"showIfEmpty\":false,\"extraClass\":\" \"},\"control\":{\"type\":\"text\"},\"uid\":\"RGETHMSFormsTest-1-1\"},\"value\":\"CCC\"}}"
    },
    "@service""apps/com.hornbill.servicemanager/Requests",
    "@method""logRequest"
  }
}
 
Result:

<?xml version="1.0" encoding="utf-8" ?>
<methodCallResult status="ok">
    <params>
        <requestId>SR00173033</requestId>
        <exceptionName>addQuestionFailure</exceptionName>
    </params>
    <flowCodeDebugState>
        <executionId>077bf616-9339-438f-97ce-caef91347e64</executionId>
    </flowCodeDebugState>
</methodCallResult>

A call logs, but no questions are on the call.
 

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...