Retrieves contact data field value ('CRDS') form the database in frontend IVR flows. This method loads data from 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 |
CEGetContactData |
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_result |
Output: To hold the value of the field. |
Exit Points
Name |
Description |
ok |
The contact data field was found and its value retrieved into m_result. |
error |
An error happened during acquiring the contact data field value. |
JSON
{
"name": "CEGetContactData",
"type": "template",
"description": "<b>CEGetContactData</b> template:<br/> Retrieve contact data frontend",
"attributes": [
{
"name": "id",
"type": "integer",
"defaultvalue": "3500"
}
],
"parameters": [
{
"name": "m_compsrv"
},
{
"name": "m_contactid"
},
{
"name": "m_campaignid"
},
{
"name": "m_datafield"
},
{
"name": "m_result"
}
],
"connections": [
{
"name": "error"
},
{
"name": "ok"
}
]
}
XML
<template name="CEGetContactData" 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_result"><![CDATA[#M_RESULT#]]></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_result" type="Variable" datatype="String" direction="Output">?</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"] = 'GetContact';
req["tenant"] = parseInt(tenantid);
req["campaignid"] = campid;
req["contactid"] = contactid;
var sresp = js.postData(url, timeout, JSON.stringify(req), mimetype);
var resp = JSON.parse(sresp);
if ((resp!= null) && (resp.result != 'ERROR')) {
for (var i=0; i< resp.contactData.length; i++) {
var cd = resp.contactData[i];
if (cd.name === '' + LOCALS['m_datafield']) {
$$m_result$$ = cd.value;
$$nextConnection$$ = 'OK';
break;
}
}
}
}
} catch (err) {
$$nextConnection$$ = 'ERROR';
log.error('Error in script:' + err);
}
log.debug('Script Done: nextConnection=' + $$nextConnection$$);
]]> </data>
</script>
</nodes>
</flow>
</template>