I was also trying to fetch the same details and finally understood how they are linked. It goes like:
The asmt_metric_result
table API response contains the user reponse (answer) for the given instance in string_value
. It also has another key called instance_question
which links to the question table.
Ex:
"instance_question": {
"link": "https://servicenow.instance/api/now/table/asmt_assessment_instance_question/abcd",
"value": "abcd"
}
Here the value refers to the sys_id
Now, when you query the asmt_assessment_instance_question
table, it will give you other links. Ex:
https://servicenow.instance/api/now/table/asmt_assessment_instance_question?sys_id=abc
This will return a response with a list of other keys.
Here you have to refer the metric
key which will link to another table called asmt_metric
.
Ex:
"metric": {
"link": "https://servicenow.instance/api/now/table/asmt_metric/def",
"value": "def"
}
- Now, you have to refer the
asmt_metric
table and it will return a response which has a key called question
which will have the actual question. Ex:
"depends_on": "",
"question": "I have reviewed the user list for terminated users.",
"max": "1",
And, to get your Assessment instance number you can either refer the instance
key returned in asmt_metric_result
or asmt_assessment_instance_question
responses.
You can also refer the source_id
key in asmt_assessment_instance_question
response as well.