Set Contact expert contact data field value ('CRDS') in the database from a frontend IVR flow. This method updates data in the CE database.
Note
The IVR flow operates in a 'frontend' manner when a customer call it handles did not yet pass through Contact Expert.
Template Data Sheet
Name |
Minimum Engine version |
Minimum Designer version |
CESetContactData |
2.1 |
7.5.0 |
Parameters
Name |
Description |
m_compsrv |
Input: Component server URL: eg. http://127.0.0.1/CompSrv/ceoh.comp |
m_contactid |
Input: ID of the Contact Expert contact. |
m_campaignid |
Input: The ID of the CE Campaign or Queue. |
m_fieldname |
Input: The name of the contact data field ('CRDS'). |
m_fieldvalue |
Input: The value of the CRDS field. |
Exit Points
Name |
Description |
ok |
The contact data field was successfully updated. |
error |
An error happened during setting the contact data field value. |
JSON
{
"name": "CESetContactData",
"type": "template",
"description": "<b>CESetContactData</b> template:<br/> Update contact data frontend",
"attributes": [
{
"name": "id",
"type": "integer",
"defaultvalue": "3600"
}
],
"parameters": [
{
"name": "m_compsrv"
},
{
"name": "m_contactid"
},
{
"name": "m_campaignid"
},
{
"name": "m_datafield"
},
{
"name": "m_datavalue"
}
],
"connections": [
{
"name": "error"
},
{
"name": "ok"
}
]
}
XML
<template name="CESetContactData" id="#ID#" version="1.0">
<parameters>
<parameter id="m_compsrv"><![CDATA[#M_COMPSRV#]]></parameter>
<parameter id="m_contactid"><![CDATA[#M_CONTACTID#]]></parameter>
<parameter id="m_campaignid"><![CDATA[#M_CAMPAIGNID#]]></parameter>
<parameter id="m_datafield"><![CDATA[#M_DATAFIELD#]]></parameter>
<parameter id="m_datavalue"><![CDATA[#M_DATAVALUE#]]></parameter>
</parameters>
<connections namedoutputs="true">
<connection name="error" destination="#ERROR#" />
<connection name="ok" destination="#OK#" />
</connections>
<flow>
<nodes>
<script id="1">
<parameters>
<parameter id="m_compsrv" type="Variable" datatype="String" direction="Input">?</parameter>
<parameter id="m_contactid" type="Variable" datatype="integer" direction="Input">?</parameter>
<parameter id="m_campaignid" type="Variable" datatype="integer" direction="Input">?</parameter>
<parameter id="m_datafield" type="Variable" datatype="String" direction="Input">?</parameter>
<parameter id="m_datavalue" type="Variable" datatype="String" direction="Input">?</parameter>
</parameters>
<connections namedoutputs="true">
<connection exitpoint="error" name="ERROR" destination="?" />
<connection exitpoint="ok" name="OK" destination="?" />
</connections>
<data><![CDATA[
try {
$$nextConnection$$ = 'ERROR';
var url = '' + LOCALS['m_compsrv'];
var campid = parseInt(LOCALS['m_campaignid']);
var contactid = parseInt(LOCALS['m_contactid']);
var tenantid = flowvars['TENANT_ID'];
if (tenantid === null) {
log.error("Tenant id not specified");
$$nextConnection$$ = 'ERROR';
}
else {
var timeout = 10000;
var mimetype = 'application/jsonrequest';
var js = toolkit.getJSonRetriever();
var req = {};
req["action"] = 'UpdateContact';
req["tenant"] = parseInt(tenantid);
req["campaignid"] = campid;
req["contactid"] = contactid;
req["contactData"] = {};
req["contactData"]["name"] = '' + LOCALS['m_datafield'];
req["contactData"]["value"] = '' + LOCALS['m_datavalue'];
var sresp = js.postData(url, timeout, JSON.stringify(req), mimetype);
//log.debug(sresp);
var resp = JSON.parse(sresp);
if ((resp!= null) && (resp.result == 'TRUE')) {
$$nextConnection$$ = 'OK';
}
}
} catch (err) {
$$nextConnection$$ = 'ERROR';
log.error('Error in script:' + err);
}
log.debug('Script Done: nextConnection=' + $$nextConnection$$);
]]> </data>
</script>
</nodes>
</flow>
</template>