For partners that build or integrate commercially available applications and service solutions with the Oracle Cloud Platform
For partners that provide implementation or managed services around Oracle Cloud Applications
Hi All,
I would like to capture FirstName and LastName of the person along with email address while capturing answer feedback. Currently the feedback is submitted annonymously without any name.
To do this, I have added firstname and lastname widgets to AnswerFeeback2 widget to capture the names with these lines of code
<rn:widget path="input/TextInput" name="contacts.first_name" />
<rn:widget path="input/TextInput" name="contacts.last_name"/>
but the names did not get into the system. It creates new contact with email address only.
Just wondering what would be the way to do this. Do I need to create a copy of AnswerFeedBack2 widget itself and modify it’s view, Controller and logic.js ?
Any suggestions would be appreciated.
Comment
The AnswerFeedback widget doesn't recognize any arbitrary fields that are added into the form. In order to capture the first/last names of the contact, you'll need to modify the logic of the widget to grab the values of the fields prior to submitting the form content. There's also no need to use the TextInput widgets here, you can just manually add in your own <input> fields and give them unique IDs.
In addition to this, you'll also need to modify the endpoint that this data is sent to, as the first/last names won't be handled on the backend either.
Be the first to rate this
|
Sign in to rate this
Makes sense. Thanks Ernie!!!
I am happy to make changes in the logic.js file but not sure about modifying the backend. I think backend here means models. The models used in this widget are 'standard/Contact_model' and 'standard/Answer_model'.
When I had a look at the contact_model.php file, there is one function called create. Is this the function I will have to modify to accomodate first_name and last_name? It would be greate if you can shed some lights at this point.
Thanks,
Be the first to rate this
|
Sign in to rate this
All of the answer feedback submission is actually handled by the Incident model since submitting answer feedback actually creates an incident. In order to give you the best guidance though, a few questions:
1. What are you trying to do with the first/last name fields? Are you going to add them to the contact that submitted the feedback? Or are you just going to add the first/last name text to the feedback incident?
2. What happens when the email address the user entered already exists in the system? Do you want to update the first/last names fields on that contact record? As a word of warning, this has the implication where I would be able to update any users first/last name just by knowing their email address.
Either way, I'd suggest you look into using hooks for this, specifically the 'pre_feedback_submit' or 'pre_contact_create' hooks.
Be the first to rate this
|
Sign in to rate this
Thanks again Ernie!!
Yes, I am going to add first_name and last_name against the contact's fields and I don't mind updating contact's name if the contact already exists in the system with same email.
I am afraid I know nothing about hooks :) .
Cheers,
Bishnu
Be the first to rate this
|
Sign in to rate this
Hi Ernie,
Could you please point us to the right direction on how to add these two fields on the logic.js as per your recommendation?
I need the exact same feature. Thanks
Average Rating:



1 rating
|
Sign in to rate this
Hi,
We managed to add some custom fields to the incident by these steps:
1. modifying the logic.js _submitFeedback() function to post to a custom controller
2. create custom controller with a modified submitAnswerFeedback to populate Custom Fields
Hopefully the code below will point you to the right direction.
_submitFeedback: function()
{
var eventObject = [];
eventObject[0] = new RightNow.Event.EventObject();
eventObject[0].w_id = this.instanceID;
eventObject[0].data = {
"summary" : this.data.js.summary,
"a_id" : this.data.js.answerID,
"rate" : this._rate,
"dialog_threshold" : this.data.attrs.dialog_threshold,
"options_count" : this.data.attrs.options_count,
"message" : this._feedbackField.value
};
if (this.data.js.isProfile)
eventObject[0].data.email = this.data.js.email;
else if (this._emailField)
eventObject[0].data.email = this._emailField.value;
var postData = {
"email": eventObject[0].data.email,
"message": eventObject[0].data.message,
"summary": eventObject[0].data.summary,
"a_id": eventObject[0].data.a_id,
"rate": eventObject[0].data.rate,
"threshold": eventObject[0].data.dialog_threshold,
"submitfeedback": eventObject[0].data.submitfeedback,
"options_count": eventObject[0].data.options_count,
"department_id" : this.data.js.departmentID, // will be inserted in custom field
"queue_id" : this.data.attrs.queue_id // will be inserted in custom field
};
RightNow.Ajax.makeRequest("/ci/ajaxCustom/submitAnswerFeedback", postData, {"data": {"eventName": "evt_answerFeedbackSubmitResponse", "data": eventObject}});
return false;
},
------------------------------------------------------------------------
function submitAnswerFeedback()
{
AbuseDetection::check();
// Do not submit if post data is missing
if (empty($_POST))
{
return;
}
$this->load->model('standard/Incident_model');
$answerID = $this->input->post('a_id');
if($answerID === 'null')
{
$answerID = null;
}
$rate = $this->input->post('rate');
$name = null;
$message = $this->input->post('message');
$givenEmail = $this->input->post('email');
$threshold = $this->input->post('threshold');
$optionsCount = $this->input->post('options_count');
$incidentId = $this->Incident_model->submitFeedback($answerID, $rate, $threshold, $name, $message, $givenEmail, $optionsCount);
// Link department to incident
$incident = RNCPHP_v1_1\Incident::fetch($incidentId);
$departmentId = $this->input->post('department_id');
$incident->CustomFields->department_id = $departmentId;
// Queue ID
$queueID = $this->input->post('queue_id');
$incident->CustomFields->feedback_queue_id = $queueID;
// Link answer to incident
$answer = RNCPHP_v1_1\Answer::fetch($answerID);
$incident->CustomAttributes->CO->answer_id = $answer;
$incident->CustomFields->answer_id = $answerID;
$incident->save();
echo json_encode($incidentId);
}
Be the first to rate this
|
Sign in to rate this
My customer portal is using Aug 2012 release, how to make connection to rightnow database.The above code is throwing me an error,while making an connection
Be the first to rate this
|
Sign in to rate this