Author Topic: SOLVED: Changing treatment or call result programatically in WDE  (Read 2985 times)

Offline Gabi

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 0
I've been having some trouble with this.

I need a way to set the treatment and/or call result of an outbound record programatically in a setting where disposition codes are not shown to the user.

For instance, I could treat a certain record as busy or wrong number if certain conditions are met.

Is there any way to do this?

I tried setting the call result of the outbound record both before and after the SetCallResultOutboundRecord command of the SetCallResultOutboundRecord chain, but that has no effect on the calling list.

I will appreciate any help you can provide.
« Last Edit: January 23, 2017, 04:41:28 PM by Gabi »

Offline Gabi

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 0
Changing treatment or call result programatically in WDE
« Reply #1 on: January 18, 2017, 05:33:11 PM »
I found a way to do it, but then the call result I set is overwritten. This is what I've done so far.

This assumes I have an InteractionPullPreview called interaction, and that I have the result I want in a variable named result, and an IObjectContainer named container.

[code]                IInteractionPullPreview previewInteraction = interaction as IInteractionPullPreview;
                IRecord outboundRecord = previewInteraction.OutboundRecord;

                outboundRecord.CallResult = result;
                outboundRecord.SystemFields["GSW_TREATMENT"] = (object)"RecordTreatCampaign";//Or "RecordTreatPersonal", depending on your needs.

                IEnterpriseServiceProvider. enterpriseServiceProvider = container.Resolve<IAgent>().EntrepriseService;
                IOutboundService oService = enterpriseServiceProvider.Resolve<IOutboundService>("outboundService");
                IDevice device = interaction.Agent.FirstMediaVoice.Device;
                oService.UpdateRecord(device, outboundRecord, null, null);[/code]

But then the MarkProcessedOutboundChain command overwrites the call result. :(
« Last Edit: January 19, 2017, 02:10:02 PM by Gabi »

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 126
  • Karma: 13
Re: Changing treatment or call result programatically in WDE
« Reply #2 on: January 20, 2017, 01:06:34 PM »
Try this code snippet, it will update the call result in the model, but not the view, but it should be enough.

            [code]
            if (!string.IsNullOrEmpty(interaction.BundleId))
            {
                IInteractionsBundle interactionBundle = interactionManager.GetBundleById(interaction.BundleId);
                if ((interactionBundle.UserData != null) && (Application.Current != null))
                {
                    Application.Current.Dispatcher.Invoke(new System.Action(delegate()
                    {
                        outboundDispositionViewModel = interactionBundle.UserData.TryGetValue("OutboundDispositionViewModel") as IOutboundDispositionViewModel;
                        if (outboundDispositionViewModel != null)
                        {
                            //Set the Call result, does not update the view..
                            outboundDispositionViewModel.SelectedCallResult = callResult;
                        }
                        else
                        {
                            log.Debug("outboundDispositionViewModel is null");
                        }
                    }));
                }
            }[/code]

Offline Gabi

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 0
Re: Changing treatment or call result programatically in WDE
« Reply #3 on: January 23, 2017, 04:40:56 PM »
Thank you!