" /> How to update calling list fields for all record of the same chain_id? - Genesys CTI User Forum

Author Topic: How to update calling list fields for all record of the same chain_id?  (Read 2978 times)

Offline alaint

  • Jr. Member
  • **
  • Posts: 50
  • Karma: 0
Advertisement
Our agents use Interaction Workspace.  For one of our calling list, we have some User-Defined Field that are editable.  When agent change the value of these User-Defined Field, we want that all record for the same chain_id was affect by these changes.

Is there a by design way to do that?  If not, how can I do that?  I was thinking about making some vb.net code on a ...beforeClose custom command.  But I have difficulty on how to talk to OCS.  I already use SDK to talk with UCS, but never with OCS.  If someone can help me with code sample, it will be perfect.

We are with Genesys 8.1.

Alain

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2755
  • Karma: 44
Re: How to update calling list fields for all record of the same chain_id?
« Reply #1 on: November 28, 2013, 02:25:14 PM »
If you have configured OCS with saving immediately result, you can do this within database (for example through trigger). I am using custom database operation within OCS solution very often.

Offline alaint

  • Jr. Member
  • **
  • Posts: 50
  • Karma: 0
Re: How to update calling list fields for all record of the same chain_id?
« Reply #2 on: November 28, 2013, 07:09:59 PM »
I'm not sure, but I think it is not possible to update another row of the same table in an update trigger?

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: How to update calling list fields for all record of the same chain_id?
« Reply #3 on: November 28, 2013, 08:33:45 PM »
Use an after trigger pulling the original chain_id

Offline alaint

  • Jr. Member
  • **
  • Posts: 50
  • Karma: 0
Re: How to update calling list fields for all record of the same chain_id?
« Reply #4 on: November 28, 2013, 08:52:28 PM »
always have this error : ORA-04091: table is mutating, trigger

Offline Steve

  • Sr. Member
  • ****
  • Posts: 298
  • Karma: 11
Re: How to update calling list fields for all record of the same chain_id?
« Reply #5 on: December 04, 2013, 02:09:19 PM »
ORA-04091: table is mutating - Means that the trigger is either changing the data that fires the trigger (an endless loop) or trying to change some data that is currently being modified by the statement that fired the trigger.

It sounds like the latter in this case, the agent changes one record in a chain and then the trigger tries to change the whole chain.
You might be able to get round it by using :NEW and :OLD in the trigger, or by excluding the record that the agent is changing.

Offline alaint

  • Jr. Member
  • **
  • Posts: 50
  • Karma: 0
Re: How to update calling list fields for all record of the same chain_id?
« Reply #6 on: December 05, 2013, 05:50:40 PM »
Take a look at the trigger I've try.  What am I doing wrong?

CREATE or REPLACE TRIGGER testAlain
AFTER UPDATE ON clist_dgag_qc_wdi_test_telem
FOR EACH ROW

BEGIN

  if updating ('field_dgag_commentaires') then
        update clist_dgag_qc_wdi_test_telem
        set field_dgag_commentaires = :new.field_dgag_commentaires
        where chain_id = :new.chain_id
        and chain_n <> :new.chain_n
        and field_dgag_commentaires <> :new.field_dgag_commentaires;
  end if;
   
END;

Offline alaint

  • Jr. Member
  • **
  • Posts: 50
  • Karma: 0
Finally, I have succed to update all records of a same chain ID, by IWS customization.

[code]
For Each record As Genesyslab.Enterprise.Model.Interaction.IRecord In interaction.OutboundChainRecord.Records
          record.CustomFields.Item("commentaires") = "commentaire"
          _outboundService.UpdateRecord(_agent.FirstMediaVoice.Device, record, Nothing, Nothing)
Next
[/code]

alaint