Genesys CTI User Forum > Genesys-related Development

WDE 8.5 - Get Interaction ID or all message properties

(1/2) > >>

fabus:
Hello,

I'm trying to modify InteractionExtensionSample, to display email interaction ID after clicked on "Button" or it would be perfect id I can get subject, from, to and body directly from items in red border.

[img width=640 height=451]http://s17.postimg.org/fezzhimzj/2015_10_05_13h36_41.png[/img]

What I already done is:
[code]
private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            IInteractionEmail email = container.Resolve<IInteractionEmail>();
            MessageBox.Show(email.InteractionId);
        }
[/code]

But result is empty.

Can somebody help to find me a way to get this data? Further I would like to save all data to text file on disk.

Best regards
Fabian

Kubig:
Is IInteraction part of your ViewModel?

fabus:
Nope I only add IInteractionEmail in Button_Click action. How to add it, because I'm not sure what you exactly mean?

PeteHoyle:
In the InteractionExtensionSample you have the Case in MySamplePresentationModel.cs, so you need to set that.

In the MySampleView.xaml.cs modify the Create method to look like this:

[code]
public void Create()
{
            IDictionary<string, object> contextDictionary = Context as IDictionary<string, object>;
                object caseView;
                contextDictionary.TryGetValue("CaseView", out caseView);
                object caseObject;
                contextDictionary.TryGetValue("Case", out caseObject);
                ICase @case = caseObject as ICase;

                if (@case != null)
                {
                    Model.Case = @case;
                }
}[/code]

Then in your button press method you can get the Case and from the Case get the Interaction, check what type of interaction it is and then get the properties of that interaction.

[code]
private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
{
//Model.ResetCounter();
            IInteraction interaction = Model.Case.MainInteraction;
            if(interaction is IInteractionInboundEmail)
            {
                IInteractionInboundEmail email = interaction as IInteractionInboundEmail;
                string subject = email.EntrepriseEmailInteractionCurrent.Subject;
                string from = email.EntrepriseEmailInteractionCurrent.From;
                string to = "";
                foreach(string s in email.EntrepriseEmailInteractionCurrent.To)
                {
                    to += " " + s;
                }
                to = to.Trim();
                string text = email.EntrepriseEmailInteractionCurrent.MessageText;
                MessageBox.Show(email.InteractionId + " Subject: " + subject);
            }
}
[/code]

fabus:
Thanks a lot for your help ;) Of course it works :D

Navigation

[0] Message Index

[#] Next page

Go to full version