Problems updating the status of a ticket using python

Beantwortet


Gepostet 29. Nov. 2023

Hi, I am trying to make a script using the Zenpy Python library in which I want to change the status automatically of some tickets to "Solved", my problem is that I receive the following error when I run the script:

Error updating ticket: {"error": "RecordInvalid", "description": "Record validation errors", "details": {"custom_status_id": [{"description": "Custom status is invalid", "error": " InvalidValue"}]}}


I have verified that the ID of the "Solved" status is correct, but I still have the same result.

Objects and rules > Tickets > Ticket statuses > Edit ticket status > 13315929

Edit ticket status

Default

View and edit your ticket status details

Solved

"custom_status_id": 13315929

This is the part of the code that generates the error:

SOLVED = 13315929

# Retrieve the open ticket

             open_ticket = zenpy_client.tickets(id=str(open_ticket_id))

           

            # Set the required fields before updating the status

             open_ticket.ticket_type = 'Problem'

             open_ticket.priority = 'Normal'

             open_ticket.status = 'Solved'

             open_ticket.custom_status_id = SOLVED

       

             # Update the open ticket

             zenpy_client.tickets.update(open_ticket)

0

2

2 Kommentare

Hi Paolo,

As you suggested, I removed the custom_status_id property, but I still had the same problem. I checked the ticket statuses and they were all active.

Looking at the JSON file of one of the tickets, I realized that the property I had to change was ticket.type and not ticket.ticket_type. After adjusting that part to my code, everything worked perfectly.

Thank you.

 

0


Hi Jose,
 
Thank you for providing the error and information about the code. I can see that you are using the custom_status_id property. I just want to confirm if you have activated custom ticket statuses? If this feature is not enabled, you can simply declare the ticket status is solved.

 
The custom_status_id is only required if the custom ticket statuses feature is enabled and you'd like to change the ticket status to a custom one. Reference here. In case your custom ticket statuses feature is activated and still getting the error even if you are declaring the correct properties in the payload, I highly suggest reaching out to our Support Team for further checking. 
 
Best,
Paolo | Technical Support Engineer | Zendesk

0


Anmelden, um einen Kommentar zu hinterlassen.

Sie finden nicht, wonach Sie suchen?

Neuer Post