Fields and Fieldsets
Context Service ships with the following default or base fields and fieldsets:
- cisco.base.customer—Intended for use with customer type Context Objects.
- cisco.base.request—Intended for use with request type Context Objects.
- cisco.base.pod—Intended for use with pod type Context Objects (activities).
- cisco.base.comment—Intended for use with detail.comment type Context Objects.
- cisco.base.rating—Intended for use with detail.feedback type Context Objects.
You can use any fieldset with any type of Context Object.
By default, all fields are searchable. Change the value of the searchable
property to specify if a field is searchable or non-searchable. Valid values are:
- No value—Default value. Indicates that the field is searchable.
false
—Specifies that a field is non-searchable.true
—Specifies that a field is searchable.
Default or Base Fields and Fieldsets
Fields and fieldsets available out-of-the-box currently include:
Fieldset cisco.base.request
field | classification | dataType | description |
---|---|---|---|
Context_Description | ENCRYPTED | string | Description of customer request or issue. |
Context_Title | ENCRYPTED | string | Title of object. |
UNENCRYPTED | string | Do not use. Use the state object property instead. Status of the request. Possible values are OPEN , RESOLVED , or CLOSED . |
|
UNENCRYPTED | string | Do not use. Date of resolution. | |
UNENCRYPTED | string | Do not use. Use the object id property instead. Unique identifier for the customer's request of issue. |
|
UNENCRYPTED | List<string> | Do not use. Use the tag object property to add tags to an object instead. Tags associated with request. |
Fieldset cisco.base.pod
field | classification | dataType | description |
---|---|---|---|
Context_Notes | ENCRYPTED | string | Notes on customer activity. |
Context_POD_Activity_Link | UNENCRYPTED | string | Link to external information relevant to this activity. |
Context_POD_Source_Cust_Name | PII | string | Name provided when activity is created. Hidden field, used to automatically populate customer information. |
Context_POD_Source_Email | PII | string | Email provided when activity is created. Hidden field, used to automatically populate customer information. |
Context_POD_Source_Phone | PII | string | Phone number provided when activity is created. Hidden field, used to automatically populate customer information. |
Fieldset cisco.base.customer
field | classification | dataType | description |
---|---|---|---|
Context_Customer_External_ID | PII | string | Store customer information from an external system, such as a unique identifier. |
Context_City | PII | string | Customer city of residence. |
Context_Country | PII | string | Customer country of residence. |
Context_First_Name | PII | string | Customer first name. |
Context_Home_Email | PII | string | Customer home email. |
Context_Home_Phone | PII | string | Customer home phone. |
Context_Last_Name | PII | string | Customer last name. |
Context_Mobile_Phone | PII | string | Customer mobile phone. |
Context_State | PII | string | Customer state of residence. |
Context_Street_Address_1 | PII | string | Customer street address; first line. |
Context_Street_Address_2 | PII | string | Customer street address; second line. |
Context_Work_Email | PII | string | Customer work email. |
Context_Work_Phone | PII | string | Customer work phone. |
Context_ZIP | PII | string | Customer's ZIP or postal code. |
Context_Preferred_Language | UNENCRYPTED | string | Preferred language of this customer. Possible values are the Context Service SDK Supported Language Codes. |
Fieldset cisco.base.comment
field | classification | dataType | description |
---|---|---|---|
Context_Comment | ENCRYPTED | string | User's comments. |
Context_Visible | UNENCRYPTED | boolean | True if the comment is visible to the customer. |
Context_DisplayName | PII | string | Name of the user making the comment. |
Fieldset cisco.base.rating
field | classification | dataType | description |
---|---|---|---|
cccRatingComments | UNENCRYPTED | string | Comments attached to the customer rating. |
cccRatingPoints | UNENCRYPTED | string | Points for the rating. |
Fieldset cisco.base.escalation
field | classification | dataType | description |
---|---|---|---|
Context_Media_Type | unencrypted | string | Type of Media used. Possible values are voice , video , chat , email , mobile , social , web , or event . |
cccCreatedBy | unencrypted | string | Name of the service that created this record. |
cccMediaSessionId | unencrypted | string | Stores the Tropo session ID. |
cccMediaSetupUrl | unencrypted | string | Stores the URL of the media setup controller. |
cccConvId | unencrypted | string | Chat room ID. |
Fieldset cisco.base.external.ids
field | classification | dataType | description |
---|---|---|---|
External_ID_AppleBusinessChat | PII | List<string> | Apple Business Chat customer identifier for this organization. |
External_ID_FacebookMessenger | PII | List<string> | Facebook Messenger customer identifier for this organization. |
External_ID_WhatsAppBusiness | PII | List<string> | WhatsApp Business customer identifier for this organization. |
Fieldset cisco.base.ccc.pod
field | classification | dataType | description |
---|---|---|---|
cccRatingPoints | UNENCRYPTED | string | Points for the rating. |
cccSipUri | UNENCRYPTED | string | |
cccRatingKeyUrl | UNENCRYPTED | string | Encryption key for the rating comment. |
cccRatingPodState | UNENCRYPTED | string | State of the pod for which the rating is being updated. |
cccConvId | UNENCRYPTED | string | Chat room ID. |
cccQueueIds | UNENCRYPTED | string | IDs of the queue to which tasks are aligned. |
cccMediaSetupUrl | UNENCRYPTED | string | Stores the URL of the media setup controller. |
cccRatingComments | UNENCRYPTED | string | Comments attached to the customer rating. |
cccChatReason | UNENCRYPTED | string | Reason for chat or callback. |
cccCreatedBy | UNENCRYPTED | string | Name of the service that created this record. |
cccCustom | UNENCRYPTED | string | Choose to indicate custom field. |
category | UNENCRYPTED | string | |
cccMediaSessionId | UNENCRYPTED | string | Stores the Tropo session ID. |
cccMediaSetupUrl | unencrypted | string | Stores the URL of the media setup controller. |
cccVirtualAssistantSummary | PII | string | Chat summary of the Customer Virtual Assistant activity. |
Fieldset cisco.base.socialminer.pod
field | classification | dataType | description |
---|---|---|---|
SM_SocialContact_Author | PII | string | Customer username. |
SM_SocialContact_RefURL | UNENCRYPTED | string | Social contact URL. |
SM_SocialContact_Description | ENCRYPTED | string | Description of social contact content. |
SM_SocialContact_SourceID | UNENCRYPTED | string | Identifier for the media channel source of a customer interaction. This can be a Chat Widget ID or a Facebook Messenger ID. |
SM_SocialContact_Subject | ENCRYPTED | string | Email subject. |
Fieldset cisco.base.ccx.pod
field | classification | dataType | description |
---|---|---|---|
CCX_CSQ | UNENCRYPTED | string | Context Service Queue ID. |
Agent_ID | PII | string | ID of agent assigned to an activity. |
Fieldset cisco.base.ece.chat.pod
field | classification | dataType | description |
---|---|---|---|
ECE_Chat_Customer_Display_Name | PII | string | Name of customer displayed during a chat activity. |
ECE_Activity_Contact_Point | PII | string | Customer contact information for an activity. |
ECE_Chat_Status | UNENCRYPTED | string | Status of the chat. Valid states are In Progress and Completed. |
ECE_Chat_Sys_Closure_State | UNENCRYPTED | string | Status of the customer connection of the last chat. |
ECE_Chat_URL | UNENCRYPTED | string | URL of the page the customer initiates the chat from. |
ECE_Activity_ID | UNENCRYPTED | string | Activity ID associated with the email. |
Fieldset cisco.base.ece.email.pod
field | classification | dataType | description |
---|---|---|---|
ECE_Email_Size | UNENCRYPTED | string | Size of the email. |
ECE_Email_ID | UNENCRYPTED | string | Unique identifier of the email. |
ECE_Activity_Contact_Point | PII | string | Customer contact information for an activity. |
ECE_Email_Date_Received | UNENCRYPTED | string | Date email is received. |
ECE_Email_Num_Attachments | UNENCRYPTED | integer | Number of email attachments. |
ECE_Email_Charset | UNENCRYPTED | string | Character set used in email. |
ECE_Activity_ID | UNENCRYPTED | string | Activity ID associated with the email. |
ECE_Activity_URI | UNENCRYPTED | string | URI of associated activity. |
Fieldset cisco.base.ece.request
field | classification | dataType | description |
---|---|---|---|
ECE_Install_Instance_ID | UNENCRYPTED | string | Unique ID generated for ECE at installation. |
ECE_Version_ID | UNENCRYPTED | string | Version of installed ECE. |
ECE_Activity_Subject | ENCRYPTED | string | Email subject of customer request. |
ECE_Activity_Type | UNENCRYPTED | string | Activity type. Valid options are chat or email. |
ECE_Language_ID | UNENCRYPTED | string | ID for language used in customer interaction. |
ECE_Activity_Case_ID | UNENCRYPTED | string | ID for the case associated with this activity. |
Custom Fields and Fieldsets
In addition to the base fields and fieldsets built into Context Service, you can create custom fields and fieldsets specific to your data model. You can create up to 100 custom fields and 100 custom fieldsets for your organization.
You can also create custom fields with enumerated values by using Cisco Webex Control Hub to create fields with the single-select type. The single-select menu options that you define in Cisco Webex Control Hub correspond to the valid enumerations for the field.
Field Enumerations
Fields use the restriction
property to restrict the possible field values further than the dataType
constraints.
The Context Service SDK can only read fields with enumerated values. You cannot use the Context Service SDK to create or update fields with enumerated values. Use Cisco Webex Control Hub to create new fields with enumerated values or to update an existing field with enumerated values. For more information on managing fields in Cisco Webex Control Hub, see Manage Context Service Fields.
You can use get methods on fields to determine:
- If a field is enumerated.
- If an enumeration is set as visible or hidden in your application UI.
- The enumeration values.
- The enumeration translations.
restriction—Restricts the value of a field to the defined type
.
type—Defines the type of restriction applied to the field as the string. For fields with enumerations, this value is Restriction.Types.ENUM
.
EnumRestriction—Contains a map of enumeration values (String
) to enumeration definitions (EnumValue
). EnumRestriction
contains a LinkedHashMap<String, EnumValue>
and extends Restriction
.
EnumValue—Provides the enumeration definition using:
- translations—Contains a map of ISO
codes to enumeration translations. - active—Specifies if the enumeration value is selectable in the application UI (
true
) or if the enumeration value is hidden (false
).
This example demonstrates using get methods on a field to determine the enumeration values, the enumeration translations, and the visibility of the enumerations in the application UI.
Copy/**
* Get an enumValues from Field
* @param contextServiceClient an initialized Context Service Client
* @return a linkedhashmap with the String and the EnumValue
*/
public static LinkedHashMap<String, EnumValue> getEnumValues(ContextServiceClient contextServiceClient) {
Field preferredLanguage = contextServiceClient.get(Field.class, "Context_Preferred_Language");
com.cisco.thunderhead.dictionary.Restriction restriction = preferredLanguage.getRestriction();
LOGGER.info("Restriction Type: ", restriction.getType());
LinkedHashMap<String, EnumValue> enumValues = ((EnumRestriction)restriction).getEnumValues();
EnumValue spanish = enumValues.get("es-ES");
LOGGER.info("Spanish enum value: isActive: ", spanish.isActive());
LOGGER.info("The English translation of the Spanish enum value:", spanish.getTranslations().get("en_US"));
return enumValues;
}
For more information on returning enumeration information, see the
.Create New Fields
Use the field()
constructor to create a new field with these arguments:
id—Field identifier specified as a string. The field ID must be unique with a maximum of 475 characters.
classification—Security classification specified as a property of
ElementClassification
. Fields are classified as:- Unencrypted—Data is not encrypted and contains no personally identifiable information.
- PII—Data is encrypted and contains personally identifiable information (PII).
- Encrypted—Data is encrypted and contains no personally identifiable information.
dataType—Data type of the field specified as a property of
ElementDataType
. Valid data types are:- String
- Double
- Integer (32-bit)
- Boolean—The default value of a Boolean data type is
false
.
publicallyAccessible—Flag specifying if the field is globally accessible by all organizations or just the organization that created the field. You cannot create new fields that are globally accessible. Setting
publicallyAccessible
totrue
throws an unauthorized error.translations—Specifies if the field is translated. Valid values are
null
for no translations or a map of ISO
codes and the translated texts that define the field name in the formatMap<String, Object>
.searchable—Specifies if the field is searchable. Set this value to
true
to allow search, and tofalse
to make the field non-searchable. Fields are searchable by default if you do not set any value.locales—List of locals that this field can be searched on as a map of ISO
codes.
This example shows how to create a field where the value is specified in English and translated in French. The function takes an initialized contextServiceClient
as the input parameter and returns the new field.
Copy/**
* Create a field with translations.
*
* @param contextServiceClient an initialized Context Service Client
* @return a field with translations
*/
public static Field createFieldWithTranslations(ContextServiceClient contextServiceClient){
Map<String, Object> translations = new HashMap<>();
translations.put(LanguageType.EN_US, "First Name");
translations.put(LanguageType.FR, "Prenom");
List<String> locales = new ArrayList<>();
locales.add("en_US");
locales.add("en_GB");
locales.add("zh_CN");
Field field = new Field("sdkExample_fieldOne", ElementClassification.PII, ElementDataType.STRING, false, translations, "true", locales);
contextServiceClient.create(field);
LOGGER.info("Created field: "+field.getId()+" with translations: "+translations.toString() + " and locales: " + String.join(", ", locales));
return field;
}
Delete Fields
This example shows how to delete a field. The function takes an initialized contextServiceClient
and the name of the field to be deleted as input arguments.
Copy/**
* Delete the specified field.
*
* @param contextServiceClient an initialized Context Service Client
* @param field a field
*/
public static void deleteField(ContextServiceClient contextServiceClient, Field field){
contextServiceClient.delete(field);
LOGGER.info("Deleted field: "+field.getId());
}
Create New Fieldsets
Use fieldset()
to add one or more fields to a fieldset, with these arguments:
- ID—Fieldset identifier specified as a string. The fieldset ID must be unique with a maximum of 475 characters.
- Fields—Set of strings containing the fields to include in this fieldset. You must define fields before you can add them to a fieldset.
This example shows how to create two new fields and add them to a fieldset. The function takes an initialized contextServiceClient
as the input parameter and returns the new fieldset with two new fields.
Copy/**
* Create two new fields and add them to a fieldset.
*
* @param contextServiceClient an initialized Context Service Client
* @param uniqueName
* @return a fieldset
*/
public static FieldSet createFieldSet(ContextServiceClient contextServiceClient, String uniqueName){
Field field1 = new Field("sdkExample_" + uniqueName + "fieldOne", ElementClassification.UNENCRYPTED, ElementDataType.STRING, false, null);
contextServiceClient.create(field1);
Field field2 = new Field("sdkExample_" + uniqueName + "fieldTwo", ElementClassification.UNENCRYPTED, ElementDataType.STRING, false, null);
contextServiceClient.create(field2);
FieldSet fieldset = new FieldSet("sdkExample_" + uniqueName + "fieldSet", new HashSet<>(Arrays.asList(field1.getIdentifier(), field2.getIdentifier())), false);
contextServiceClient.create(fieldset);
LOGGER.info("Created fieldset: "+fieldset.getId()+" with fields: "+fieldset.getFields().toString());
return fieldset;
}
Update Fieldsets
You can update fieldsets to add new fields, delete fields, or modify fields.
In Cisco Webex Control Hub, after you add or remove fields to an existing fieldset, any changed fields are not immediately available in the Context Service SDK. For up to 30 minutes, you can not associate the modified fieldset with an object if the fieldset contains changed fields.
This example shows how to add a new field to a fieldset. The function takes an initialized contextServiceClient
and the chosen fieldset as input parameters and returns the updated field.
Copy/**
* Add a new field to the specified fieldset.
*
* @param contextServiceClient an initialized Context Service Client
* @param fieldSet a fieldset to be updated
* @return a fieldset
*/
public static FieldSet updateFieldSet(ContextServiceClient contextServiceClient, FieldSet fieldSet){
Field field = new Field("sdkExample_fieldThree", ElementClassification.UNENCRYPTED, ElementDataType.STRING, false, null);
Set<String> fields = fieldSet.getFields();
fields.add(field.getIdentifier());
fieldSet.setFields(fields);
LOGGER.info("Updated fieldSet: "+fieldSet.getId()+" by adding field "+field.getId());
return fieldSet;
}
Delete Fieldsets
Deleting a fieldset does not delete the fields included in that fieldset.
This example shows how to delete a fieldset. The function takes an initialized contextServiceClient
and the name of the fieldset to be deleted as input arguments.
Copy/**
* Delete the specified fieldset.
*
* @param contextServiceClient an initialized Context Service Client
* @param fieldSet a fieldset
*/
public static void deleteFieldSet(ContextServiceClient contextServiceClient, FieldSet fieldSet){
contextServiceClient.delete(fieldSet);
LOGGER.info("Deleted fieldSet: "+fieldSet.getId());
}
Search Fields and Fieldsets
Use a search query to search fields and fieldsets.
These examples show how to search using a search query specifying ID and field or fieldset name. The functions take an initialized contextServiceClient
and the search query as the input argument and return a list of fields or fieldsets that match the search query.
Copy/**
* Search fieldsets using a search query.
*
* @param contextServiceClient an initialized Context Service Client
* @param uniqueName
* @return List<FieldSet> a list of fieldsets that match the search query
*/
public static List<FieldSet> searchFieldSet(ContextServiceClient contextServiceClient, String uniqueName){
LOGGER.info("Constructing search query ...");
SearchParameters params = new SearchParameters();
params.add("id","sdkExample_" + uniqueName + "fieldSet");
LOGGER.info("Searching for fieldSet in ContextService based on query: " + params.toString());
List<FieldSet> fieldsets = contextServiceClient.search(FieldSet.class, params, OR);
for (FieldSet fieldset : fieldsets) {
LOGGER.info("Found Field Set " + fieldset.getId());
}
return fieldsets;
}
/**
* Search fieldsets using a search query.
*
* @param contextServiceClient an initialized Context Service Client
* @param uniqueName
* @return List<FieldSet> a list of fieldsets that match the search query
*/
public static List<FieldSet> searchFieldSet(ContextServiceClient contextServiceClient, String uniqueName){
LOGGER.info("Constructing search query ...");
SearchParameters params = new SearchParameters();
params.add("id","sdkExample_" + uniqueName + "fieldSet");
LOGGER.info("Searching for fieldSet in ContextService based on query: " + params.toString());
List<FieldSet> fieldsets = contextServiceClient.search(FieldSet.class, params, OR);
for (FieldSet fieldset : fieldsets) {
LOGGER.info("Found Field Set " + fieldset.getId());
}
return fieldsets;
}