Choice Attributes
Introduction
A choice attribute is a type of campaign attribute that provides multiple preset options to be selected from. Choice attributes only accept values that match one of the options configured in the system.
Choice attributes can be used to collect survey data or data that will be used as part of a validation rule.
For example a CHOICE attribute could ask the consumer where they purchased their product with options such as:
- In Store
- Online
- Over the Phone
Choice Attribute Choices
When a choice attribute is returned from the campaigns service read API it will look something like the example below. Note that the type is CHOICE
and there is a choices list containing a choice object for each choice options available.
{
"reverseKeyVerifyFlag": false,
"webSearchable": false,
"name": "Purchase Location",
"type": "CHOICE",
"value": null,
"displayName": "Purchase Location",
"masterAttributeId": 14737,
"mustBeCapturedFlag": true,
"deDupableFlag": false,
"isUCIDFlag": false,
"isThirdPartyFlag": false,
"keyVerifyFlag": false,
"usageFlags": {
"displayConsumerCareFlag": true,
"displayDataEntryFlag": true,
"displayConsumerFlag": true,
"displayCareSiteFlag": true
},
"attributeId": 2868352,
"displayOrder": 1,
"choices": [{
"campaignAttribId": 2868352,
"displayValue": "In Store",
"captureValue": "IN-STORE",
"deleteFlag": false
}, {
"campaignAttribId": 2868352,
"displayValue": "Online",
"captureValue": "ONLINE",
"deleteFlag": false
}, {
"campaignAttribId": 2868352,
"displayValue": "Over the Phone",
"captureValue": "OVER THE PHONE",
"deleteFlag": false
}
]
}
Choices
Each choice option object contains the following attributes:
Name | Description | Type |
---|---|---|
campaigAttribId | This is the attribute id for the campaign attribute these choices belong to. | Integer |
displayValue | This is the string that should be presented to the end user to select from. | String |
captureValue | This is the value that should be sent for the choice attribute option (if selected) when creating a submission. | String |
deleteFlag | Indicates if the option has been deleted. | Boolean |
Handling Choice Attributes When Creating a Submission
When creating a submission the choice attribute value provided in captureValue
should be sent as the value with the type always being set to TEXT
.
For example for the Purchase Location attribute we reviewed above, if the end-user selected In Store
you would send the captureValue
of IN-STORE
in the value
attribute and the type
attribute as TEXT
:
{
"name": "Purchase Location",
"value": "IN-STORE
"type": "TEXT"
},
Choice type attributes must always be sent as TEXT.
Updated about 5 years ago