Can you help me to create a code to connect at correct signal when the ticket change status in closed? Thanks
Signal when ticket change status at closed
Changing the status would send out an object.edited
signal. So something like:
Signal::connect('object.edited', function($var) {
// Do stuff here
});
... or:
Signal::connect('object.edited', array('Class', 'method'));
... will do the trick. The code is open-source so you can lookup and review existing examples in the code.
Cheers.
- Edited
Hi Kevin,
I want read custom form values in the ticket when:
- ticket is closed
- ticket is a specific HelpTopic
I tried to write the code but I don't like it :-( , this the code:
Signal::connect('object.edited', function($var) {
if($_REQUEST['id']) {
if (($ticket = Ticket::lookup($_REQUEST['id']))) {
$isClosed = $ticket->isClosed();
if ($isClosed){
if("CustomTopic"==$ticket->getHelpTopic()){
$topic = $ticket->getTopic();
$forms = $topic->getForms();
foreach($forms as $form) {
$fields=$form->getFields();
foreach($fields as $field) {
$value=$field->getValue();
if($value){
error_log($value);
}
}
}
}
}
}
}
});
Can you help me to write the correct code?
Thanks
Hi,
I have an issue to read value inside $field
, I tried a lot of method but always obtain an empty $value
, can you help me?
For example:
foreach($fields as $field) {
$value=$field->getValue();
}
Thanks
I cannot assist in writing custom code (I'm a core dev). You'll need to do some debugging or wait for someone else to post here.
Cheers.