Skip to main content
Content Starts Here

We've Moved!

Please note that we have moved to our New Forum site.


Ask Search:
Marco BrunettiMarco Brunetti 

How can i update a terminated interaction in UCS using PSDK modifying the StrAttribute field/column?

Hi,

How can i update a terminated interaction in UCS using PSDK modifying the StrAttribute field/column?
I'm using PSDK 8.5 to manage closed and stored interactions in UCS DB.
We have custom attributes stored on StrAttributeN columns.
We should update a value stored in StrAttribute3 column but with the RequestUpdateInteraction request we can't update StrAttribute fields.
The only mandatory attribute for this request is

com.genesyslab.platform.contacts.protocol.contactserver.InteractionAttributes

but with this object seems not possible to set custom fields.

Thanks

 
Best Answer chosen by Marco Brunetti
Pete HoylePete Hoyle (Genesys)
You need to use the configured name of your StrAttribute3.
For example in my environment StrAttribute3 has a name of 'survey_answer_Overall' and a Display Name of 'Survey Overall'. So I use the Name 'survey_answer_Overall' instead of StrAttribute3


            String now = DateTime.Now.ToString();
            RequestGetInteractionContent reqGet = RequestGetInteractionContent.Create();
            reqGet.InteractionId = "0375MP2M0S5D802E";
            EventGetInteractionContent content = ucsProtocol.Request(reqGet) as EventGetInteractionContent;
            Debug.WriteLine(content);
            if (content.InteractionAttributes.AllAttributes.ContainsKey("survey_answer_Overall"))
            {
                Debug.WriteLine("survey_answer_Overall = " + content.InteractionAttributes.AllAttributes.GetAsString("survey_answer_Overall"));
                content.InteractionAttributes.AllAttributes.Remove("survey_answer_Overall");
                
            }

            KeyValueCollection kvc = content.InteractionAttributes.AllAttributes;
            kvc.Add("survey_answer_Overall", now);
            content.InteractionAttributes.AllAttributes = kvc;
            RequestUpdateInteraction req = RequestUpdateInteraction.Create();
            req.InteractionAttributes = content.InteractionAttributes;
            IMessage res = ucsProtocol.Request(req);
            Debug.WriteLine(res);

All Answers

Pete HoylePete Hoyle (Genesys)
You need to use the configured name of your StrAttribute3.
For example in my environment StrAttribute3 has a name of 'survey_answer_Overall' and a Display Name of 'Survey Overall'. So I use the Name 'survey_answer_Overall' instead of StrAttribute3


            String now = DateTime.Now.ToString();
            RequestGetInteractionContent reqGet = RequestGetInteractionContent.Create();
            reqGet.InteractionId = "0375MP2M0S5D802E";
            EventGetInteractionContent content = ucsProtocol.Request(reqGet) as EventGetInteractionContent;
            Debug.WriteLine(content);
            if (content.InteractionAttributes.AllAttributes.ContainsKey("survey_answer_Overall"))
            {
                Debug.WriteLine("survey_answer_Overall = " + content.InteractionAttributes.AllAttributes.GetAsString("survey_answer_Overall"));
                content.InteractionAttributes.AllAttributes.Remove("survey_answer_Overall");
                
            }

            KeyValueCollection kvc = content.InteractionAttributes.AllAttributes;
            kvc.Add("survey_answer_Overall", now);
            content.InteractionAttributes.AllAttributes = kvc;
            RequestUpdateInteraction req = RequestUpdateInteraction.Create();
            req.InteractionAttributes = content.InteractionAttributes;
            IMessage res = ucsProtocol.Request(req);
            Debug.WriteLine(res);
This was selected as the best answer
Marco BrunettiMarco Brunetti
Hi Pete,
the answer you posted is correct and works fine.
I've tried the code you wrote adapted at our scenario and now we can update interaction and custom attributes successfully.
Thank you very much.