Skip to main content

Reasoned answer

The functions available on reasoned answers API are:

FunctionDescription
getPopup()Retrieves response popup
registerForFieldChange(String fieldName, function callback)Allows subscription to field modification in response popup
getReasonedAnswerId()Retrieves action identifier
getTasks()Retrieves the list of tasks associated with the response

Examples:

JSAPI.get().registerForReasonedAnswerOpen(function (reasonedAnswerAPI, reasonedAnswerId) {
console.log("Opened reasoned answer Id: " + reasonedAnswerAPI.getReasonedAnswerId());
});
JSAPI.get().getReasonedAnswerAPI(<answer identifier>).registerForFieldChange("Comments", function(fieldName, fieldValue) {
console.log("Value of " + fieldName + " changed to: " + fieldValue);
});

Note: In this part, the variable reasonedAnswerId is used to identify the response just opened

Please note: When displaying several reasoned answers forms, it may be necessary to access a particular form: JSAPI.get().getReasonedAnswerAPI(<answer identifier>).