hi all,
I create a ticket with following code.
$TicketNumber = $RPC->Dispatch($User, $Pw, 'TicketObject','TicketCreateNumber');
print "RPC: New Ticketnumer created: ".$TicketNumber."\n";
$TicketId = $RPC->Dispatch($User, $Pw, 'TicketObject', 'TicketCreate',
TN => $TicketNumber,
Title => encode("utf-8", decode("gb2312", $subject)),
Queue => encode("utf-8", decode("gb2312", $agentQueue)), # or QueueID => 123,
Lock => 'unlock',
PriorityID => 2, # or PriorityID => 2,
StateID => $stateID, # or State => 'open',
CustomerUser => $customerUser,
# CustomerId => '003',
OwnerID => 1, # new owner
ResponsibleID => 1, # new responsible
UserID => 1)
how can i change the ticket state(for instance state 'open') with rpc?? ths
How to change a ticket state with rpc?
Moderator: crythias
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: How to change a ticket state with rpc?
You're so close!
That # is a comment.
If you had a guess what to do, what would *you* think would work?
You can choose to use StateID OR State. Use StateID if you *know* the ID number of the state you want. Use State if you want to type the word(s) for the State (hence, 'or') You can browse the stateID from Admin Status interface. Hovering over the links will tell you the ID= at the end of the URL in the status bar of your browser, or just click on a status and look in the address bar.
This doesn't *change* the state from here, but it does set it for a new ticket.
To Set the State after the ticket has been created:
What's do you do with that? Well, if you're changing the state, you'll need to know the TicketID (This is an index, not the generated ticket number. If you looked at the URL, you'd see the ticketID)
You'd need to know the UserID who is making the State change.
You'd need to know the state to change to.
So, I'd suppose you'd call that StateSet something like:
$SetState = $RPC->Dispatch($User, $Pw, 'TicketObject', 'StateSet',
TicketID => $TicketId,
StateID => $StateId, # or StateId => 4, or State=> 'open',
UserID => $UserId #or UserID =>1 if you just want system to change the state
)
On second thought, maybe I shouldn't be typing this stuff at 2am my time after Thanksgiving dinner I probably am overlooking something important. Well, you asked, so if you want to change the state of the ticket, your program should know what it's changing. Have a great day!
Code: Select all
StateID => $stateID, # or State => 'open',
If you had a guess what to do, what would *you* think would work?
Code: Select all
State => 'open',
This doesn't *change* the state from here, but it does set it for a new ticket.
To Set the State after the ticket has been created:
Code: Select all
to set a ticket state
$TicketObject->StateSet(
State => 'open',
TicketID => 123,
UserID => 123,
);
$TicketObject->StateSet(
StateID => 3,
TicketID => 123,
UserID => 123,
);
Optional attribute:
SendNoNotification, disable or enable agent and customer notification for this
action. Otherwise a notification will be send to agent and cusomer.
For example:
SendNoNotification => 0, # optional 1|0 (send no agent and customer notification)
You'd need to know the UserID who is making the State change.
You'd need to know the state to change to.
So, I'd suppose you'd call that StateSet something like:
$SetState = $RPC->Dispatch($User, $Pw, 'TicketObject', 'StateSet',
TicketID => $TicketId,
StateID => $StateId, # or StateId => 4, or State=> 'open',
UserID => $UserId #or UserID =>1 if you just want system to change the state
)
On second thought, maybe I shouldn't be typing this stuff at 2am my time after Thanksgiving dinner I probably am overlooking something important. Well, you asked, so if you want to change the state of the ticket, your program should know what it's changing. Have a great day!
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: How to change a ticket state with rpc?
crythias,
thanks for your reply.
Suppose:
tn is 2010101810000615 and TicketID is 110
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
my $SetState = $RPC->Dispatch($User, $Pw, 'TicketObject', 'StateSet',
TicketID => '110',
StateID => 4,
UserID => 1
);
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Question:
how to get TicketID by tn with rpc?
thanks for your reply.
Suppose:
tn is 2010101810000615 and TicketID is 110
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
my $SetState = $RPC->Dispatch($User, $Pw, 'TicketObject', 'StateSet',
TicketID => '110',
StateID => 4,
UserID => 1
);
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Question:
how to get TicketID by tn with rpc?
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: How to change a ticket state with rpc?
You really should be reading the documentation inside of Kernel/System/Ticket.pm. You'll get your answers faster and more accurate than from me.
But, as it is, I'm a "give a man a fish" some times.
But, as it is, I'm a "give a man a fish" some times.
Code: Select all
=item TicketIDLookup()
ticket id lookup by ticket number
my $TicketID = $TicketObject->TicketIDLookup(
TicketNumber => '2004040510440485',
UserID => 123,
);
=cut
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: How to change a ticket state with rpc?
$TicketId = $RPC->Dispatch($User, $Pw, 'TicketObject', 'TicketIDLookup',
TicketNumber => $ticketNum,
UserID => 1);
crythias,
many thanks for your "fish"!!!
TicketNumber => $ticketNum,
UserID => 1);
crythias,
many thanks for your "fish"!!!