Genesys CTI User Forum
Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: cavagnaro on November 09, 2017, 06:57:51 PM
-
Hi,
Customer needs that when agent updates a custom field by RecordProcessed or UpdateCallCompletitionStats, all chains in that record, update the same value.
Say, if for example, at the start of call we have for chain_id = 73
chain_n = 0 | CUST_FIELD = "" (RH 0)
chain_n = 1 | CUST_FIELD = "" (RH 1)
chain_n = 2 | CUST_FIELD = "" (RH 2)
When agent does a UpdateCallCompletitionStats with RH 0, all other records (chain_n 1 and chain_n 2) also get the same value ending in:
chain_n = 0 | CUST_FIELD = "SOME VALUE" (RH 0)
chain_n = 1 | CUST_FIELD = "SOME VALUE" (RH 1)
chain_n = 2 | CUST_FIELD = "SOME VALUE" (RH 2)
What happens today is that only RH is updated.
chain_n = 0 | CUST_FIELD = "SOME VALUE" (RH 0)
chain_n = 1 | CUST_FIELD = "" (RH 1)
chain_n = 2 | CUST_FIELD = "" (RH 2)
I have tried the option update_all_records = true but doesn't seem to work in the way is needed.
Worst if we do a Reschedule to a new number, then the reschedule doesn't bring the value and is useless at the end.
What would I need to do to update all chains in that chain_id?
Multiple UpdateCallCompletitionStats? For I have tried won't work as seems to update only 1 record always.
-
I don’t know how this can be achieved in Genesys either, but you can have a trigger on the DB that does the trick (as long as the record is not on “retrieved” state, you should be able to use this)
-
That is the issue I think, the AFTER trigger is an idea too but not quite sure if will work...
Do you have a sample trigger by any chance? :P
-
[quote author=cavagnaro link=topic=10737.msg48809#msg48809 date=1510311792]
That is the issue I think, the AFTER trigger is an idea too but not quite sure if will work...
Do you have a sample trigger by any chance? :P
[/quote]
For Oracle?
-
Can be
Just to grab the idea
Enviado de meu E6633 usando Tapatalk
-
for SQL Server would be something like below:
[code]
create or alter trigger dbo.trg_update_chain_data
on <your table name here>
after update as
declare @chainid int
declare @custfield varchar
begin
if trigger_nestlevel() <= 1 -- this prevents recurstion on the trigger
begin
if exists (select 1 from deleted where (cust_field = '') or (cust_field is null) )
and exists (select 1 from inserted where (cust_field <> ''))
begin
select @chainid = chain_id from inserted
select @custfield = cust_field from inserted
update <your table name here> set cust_field = @custfield where chain_id = @chainid
end
end
end
[/code]
For Oracle, I have to dig a little bit more to check how to prevent trigger recursion
-
Sql is fine
Will check it
Thanks!
Enviado de meu E6633 usando Tapatalk