Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#7994 closed task (worksforme)

how to set and action (for workflow) via xmlrpc

Reported by: sanjay Owned by: Odd Simon Simonsen
Priority: normal Component: XmlRpcPlugin
Severity: normal Keywords:
Cc: Olemis Lang Trac Release: 0.11

Description (last modified by Odd Simon Simonsen)


I cannot figure out how to change the ticket status (e.g. reassign to someone) via xmlrpc.

I am trying to use: array ticket.update(int id, string comment, struct attributes={}, boolean notify=False)

the api says: Update a ticket, returning the new ticket in the same form as getTicket(). Requires a valid 'action' in attributes to support workflow.

what should the attributes structure look like exactly? I assume a valid action would mean 'reassign'. But I cant figure out how I need to pass the parameters into the api. I hope someone can help!

I am usinc xmlrpc via c# and have a standard workflow.

accept = new,assigned,accepted,reopened -> accepted
accept.operations = set_owner_to_self
accept.permissions = TICKET_MODIFY
leave = * -> *
leave.default = 1
leave.operations = leave_status
reassign = new,assigned,accepted,reopened -> assigned
reassign.operations = set_owner
reassign.permissions = TICKET_MODIFY
reopen = closed -> reopened
reopen.operations = del_resolution
reopen.permissions = TICKET_CREATE
resolve = new,assigned,accepted,reopened -> closed
resolve.operations = set_resolution
resolve.permissions = TICKET_MODIFY

Attachments (0)

Change History (2)

comment:1 Changed 6 years ago by Odd Simon Simonsen

Description: modified (diff)
Resolution: worksforme
Status: newclosed

Mailing list would be better for "support" issues...

Anyway, the basic idea is:

  1. Use ticket.getActions(int id) to get all available actions for the ticket. The documentation for this command says: "Returns the actions that can be performed on the ticket as a list of [action, label, hints, [input_fields]] elements, where input_fields is a list of [name, value, [options]] for any required action inputs.". It will return the actions allowed by the user on the ticket in current state, and with any additional fields - like the web form does.
  2. To attributes you add 'action', for instance 'reassign'. But, as from 1. above you would see that reassigning includes a separate input field, that field must also be added. So, the minimum attributes posted would need to be {'action': 'reassign', 'action_reassign_reassign_owner': 'osimons'}.


comment:2 Changed 6 years ago by sanjay

thanks very much indeed!

Modify Ticket

as closed The owner will remain Odd Simon Simonsen.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.