Quantcast
Viewing all articles
Browse latest Browse all 2504

Exception thrown when calling save() on custom object

Topic by Christopher Farmer

Hi,

An exception is being thrown when a contact updates an incident through the CP. The exception is only thrown for certain contacts – incidents that I raise do not cause the exception to be thrown, but my colleague's incidents do.

To provide a bit of background: I’m creating a custom object which is a child object of an incident. It is initialised with the value that a user enters into a custom field on the update form. This custom object is created in a model which is called by a post_incident_update hook. When this custom object is saved, or indeed when this field is accessed, the exception is thrown.

The message in the error log and exception is as follows:

"Pair Error

        File: php/php_util.c

        Line: 338

      In Fcn: cf_pair_php

     API Fcn: incident_update

  Pair Chain: prev=>custom_field

Description: Value must be >= 0 and <= 100000, id='244', data='118143'"

From this, I deduced that the custom field with ID ‘244’ may be causing the problem. Custom field 244 is an incident custom field. I have tried setting a value for this field if it is null or the current value is outside the acceptable range, but reading the value of this field or saving the incident causes the error to be thrown, so I can’t get around it that way.

I have checked the audit and rule logs to see if there are any obvious differences between mine and my colleague’s incidents. The audit log indicated that when each of us raise an incident, business rules are assigning our incidents to a different group.

I then checked the rule log to see if I could work out which rule might be setting this value. The rule which has caught my eye executes an external event, which suggests it could be an error in this code. Further, the call stack in the rule log references two files - one of which is a custom model that I have not touched before, the other is the standard Incident model.

Does anyone have any advice as to how I could go about getting around this error? I am tempted to ask Customer Care for assistance seeing as an external event is executed, but if I simply bypass the post_incident_update hook entirely then the exception is not thrown.

Any advice/suggestions/help would be greatly appreciated.

Many thanks.


Viewing all articles
Browse latest Browse all 2504

Trending Articles