Call Notes View Associated With Call Record
Posted: Wed Nov 01, 2017 3:28 pm
Greetings all. I built a view in the database and a PHP app which shows the call notes for administrative purposes. Records can be searched and downloaded to build a new list or report to the client. My problem is associating the call notes with the call record to obtain the disposition etc. We have a client we receive inbound for and many call are from different employees at companies so therefore the same phone number and lead_id. We identify the record by entering the caller's name in the call notes. We have done this with custom archiving of the vicidial_list and vicidial_lists tables to be sure we keep records.
How can I add the call record to the view to obtain the call details such as disposition (Status), duration etc? Below is the view.
SELECT
`n`.`notesid` AS `notesid`,
`n`.`lead_id` AS `lead_id`,
`n`.`vicidial_id` AS `vicidial_id`,
`n`.`call_date` AS `call_date`,
`n`.`order_id` AS `order_id`,
`n`.`appointment_date` AS `appointment_date`,
`n`.`appointment_time` AS `appointment_time`,
`n`.`call_notes` AS `call_notes`,
`l`.`first_name` AS `first_name`,
`l`.`last_name` AS `last_name`,
`l`.`phone_number` AS `phone_number`,
`l`.`list_id` AS `list_id`,
`r`.`campaign_id` AS `campaign_id`
FROM
(
(
`vicidial_call_notes` `n`
JOIN `vicidial_list` `l` ON (
(
`n`.`lead_id` = `l`.`lead_id`
)
)
)
JOIN `vicidial_lists` `r` ON (
(
`l`.`list_id` = `r`.`list_id`
)
)
)
UNION
SELECT
`n`.`notesid` AS `notesid`,
`n`.`lead_id` AS `lead_id`,
`n`.`vicidial_id` AS `vicidial_id`,
`n`.`call_date` AS `call_date`,
`n`.`order_id` AS `order_id`,
`n`.`appointment_date` AS `appointment_date`,
`n`.`appointment_time` AS `appointment_time`,
`n`.`call_notes` AS `call_notes`,
`l`.`first_name` AS `first_name`,
`l`.`last_name` AS `last_name`,
`l`.`phone_number` AS `phone_number`,
`l`.`list_id` AS `list_id`,
`r`.`campaign_id` AS `campaign_id`
FROM
(
(
`vicidial_call_notes_archive` `n`
JOIN `vicidial_list_archive` `l` ON (
(
`n`.`lead_id` = `l`.`lead_id`
)
)
)
JOIN `vicidial_lists` `r` ON (
(
`l`.`list_id` = `r`.`list_id`
)
)
)
How can I add the call record to the view to obtain the call details such as disposition (Status), duration etc? Below is the view.
SELECT
`n`.`notesid` AS `notesid`,
`n`.`lead_id` AS `lead_id`,
`n`.`vicidial_id` AS `vicidial_id`,
`n`.`call_date` AS `call_date`,
`n`.`order_id` AS `order_id`,
`n`.`appointment_date` AS `appointment_date`,
`n`.`appointment_time` AS `appointment_time`,
`n`.`call_notes` AS `call_notes`,
`l`.`first_name` AS `first_name`,
`l`.`last_name` AS `last_name`,
`l`.`phone_number` AS `phone_number`,
`l`.`list_id` AS `list_id`,
`r`.`campaign_id` AS `campaign_id`
FROM
(
(
`vicidial_call_notes` `n`
JOIN `vicidial_list` `l` ON (
(
`n`.`lead_id` = `l`.`lead_id`
)
)
)
JOIN `vicidial_lists` `r` ON (
(
`l`.`list_id` = `r`.`list_id`
)
)
)
UNION
SELECT
`n`.`notesid` AS `notesid`,
`n`.`lead_id` AS `lead_id`,
`n`.`vicidial_id` AS `vicidial_id`,
`n`.`call_date` AS `call_date`,
`n`.`order_id` AS `order_id`,
`n`.`appointment_date` AS `appointment_date`,
`n`.`appointment_time` AS `appointment_time`,
`n`.`call_notes` AS `call_notes`,
`l`.`first_name` AS `first_name`,
`l`.`last_name` AS `last_name`,
`l`.`phone_number` AS `phone_number`,
`l`.`list_id` AS `list_id`,
`r`.`campaign_id` AS `campaign_id`
FROM
(
(
`vicidial_call_notes_archive` `n`
JOIN `vicidial_list_archive` `l` ON (
(
`n`.`lead_id` = `l`.`lead_id`
)
)
)
JOIN `vicidial_lists` `r` ON (
(
`l`.`list_id` = `r`.`list_id`
)
)
)