cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1221
Views
1
Helpful
19
Replies

PCCE 12.5 agent update failure

I had a failure in my agent update python script. Here is the XML I got back.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><apiErrors><ap
iError><errorMessage>400 Bad Request - javax.xml.bind.UnmarshalException: unexpe
cted element (uri:&quot;&quot;, local:&quot;agent&quot;). Expected elements are
&lt;{}department&gt;</errorMessage></apiError></apiErrors>

I think what is really going on here is I exceeded the number of skills assigned to the agent because my code worked for 30 of the 32 agents I was processing. I didn't need to change the department on the user, and I don't think there was a department assigned. I googled around for the limit of skills for an agent, but I couldn't find it. This user already had a bunch of skill and I was using the 'skillGroupsAdded' block in the XML update.

19 Replies 19

I found the limit of skills per agent (15), and this update would definitely have exceeded that. That said, that is a wildly inaccurate error message. What gives there?

This gets stranger and stranger. I was able to assign 21 skills to an agent in the SPOG. Now I have no idea why the API agent update failed.

After more starting at the data, these two agents were explicitly assigned to the 'Global' department. If the agent has a department assigned, is that a required value in the update? It is looking that way, but I don't understand why.

Last thing for the day. My code works to change a department if no department is currently assigned to the user. If there is a department currently assigned, I can't seem to get it to work. Same error as in the first post. Clearly I am missing something, but I don't know what.

It's been a while since I touched it, but I believe you have to update everything that is set in the agent so for example if they have a department set you have to send that department. So something like:

...

         <department>
          <refURL>/unifiedconfig/config/department/5001</refURL>
          <name>debit_card</name>
         </department>

...

david

No, I tried that and it still failed with the same error message. It works every time if the user is in the default department (meaning not explicitly set). It fails every time if the department is explicitly set. There has to be something special about department updates. It doesn't require that I specify the name or any other value that is not being changed.

I spent a bit of time trying to recreate your issue, but no dice. I got the dCloud PCCE (12.6.1) and was able to make this work with no problem. My agent with a dept:

Screenshot 2023-08-20 at 2.13.10 PM.png

My PUT request:

<?xml version="1.0" encoding="UTF-8"?>
<agent>
<changeStamp>21</changeStamp>
<agentAttributes>
<agentAttribute>
<attributeValue>true</attributeValue>
<attribute>
<refURL>/unifiedconfig/config/attribute/5040</refURL>
<name>CumulusUtility</name>
<dataType>3</dataType>
<description>Cumulus Utility</description>
</attribute>
</agentAttribute>
<agentAttribute>
<attribute>
<refURL>/unifiedconfig/config/attribute/5039</refURL>
<name>CumulusCity</name>
<dataType>3</dataType>
<description>Cumulus City</description>
</attribute>
</agentAttribute>
</agentAttributes>
</agent>
 
 
david

Unless I am missing it, I don't see a change in department in your XML update. Here is an update from my script when the agent does not have an explicit department set.

<agent>
  <changeStamp>54</changeStamp>
  <department>
    <name>TEST</name>
    <refURL>/unifiedconfig/config/department/5017</refURL>
  </department>
  <agentTeam>
    <name>OHMG_Oncology</name>
    <refURL>/unifiedconfig/config/agentteam/5193</refURL>
  </agentTeam>
  <description>OHMG-Phase-2a-ONC-G1</description>
</agent>

 That update succeeds. Here is a subsequent update to the same agent attempting to explicitly set the department to Global.

<agent>
  <changeStamp>55</changeStamp>
  <department>
    <name>Global</name>
    <refURL>/unifiedconfig/config/department/5009</refURL>
  </department>
  <agentTeam>
    <name>OHMG_Oncology</name>
    <refURL>/unifiedconfig/config/agentteam/5193</refURL>
  </agentTeam>
  <description>OHMG-Phase-2a-ONC-G1</description>
</agent>

 This one fails with the same error message. I don't see anything different in the syntax. This is just maddening!

put return <?xml version="1.0" encoding="UTF-8" standalone="yes"?><apiErrors><ap
iError><errorMessage>400 Bad Request - javax.xml.bind.UnmarshalException: unexpe
cted element (uri:&quot;&quot;, local:&quot;agent&quot;). Expected elements are
&lt;{}department&gt;</errorMessage></apiError></apiErrors>

FYI, this is on PCCE 12.5(1) Build Number: 53 ES: 25.

@Elliot Dierksen Now I'm lost, not hard to do, I thought the issue was that an agent with a department could not be updated with new attributes. Was this not what you were after?

david

It appears to block me from making any changes to the agent if the department is set. The I have tried setting it to its current value or omitting it. I used the same update XML. Once when the user had department explicitly set to 'Global' and once where it was defaulting to 'Global' Here is the update XML.

 

<agent>
  <changeStamp>59</changeStamp>
  <agentTeam>
    <name>OHMG_Oncology</name>
    <refURL>/unifiedconfig/config/agentteam/5193</refURL>
  </agentTeam>
  <description>OHMG-Phase-2a-ONC-G1</description>
</agent>

 

 As you can see, there is no reference to a department, but it still returns the same failure message.

 

put return <?xml version="1.0" encoding="UTF-8" standalone="yes"?><apiErrors><apiError><errorMessage>400 Bad Request - javax.xml.bind.UnmarshalException: unexpected element (uri:&quot;&quot;, local:&quot;agent&quot;). Expected elements are &lt;{}department&gt;</errorMessage></apiError></apiErrors>

 

 If I clear the explicit setting of department in the SPOG, the update succeeds.

Edit: I didn't list it, but the code does read the appropriate value from the API for changeStamp before making the change.

Wait, so you're trying to update the Team for an agent in a department. Is the team under that department the agent is part of?

david

I always update the team based on the input file, and usually adding skills too. 'Global' is the default department. If the agent is explicitly set to 'Global' then the update fails. Perhaps this is some kind of department relationship validation issue, but the error message isn't telling me very much. That doesn't make too much sense if the user is explicitly set to the default 'Global' department.

It has to be some kind of dept restriction on the skill or agent. If you make the same update via SPOG does it work? I was able to update the skills on a Global and specific department. The specific department didn’t have anything assigned to it though.

david