Update custom field on all Childs on Resolve

Hey

I hope you are doing good.

I need to write a Scrip to update C.F Resolution on all childs of an Incident on Resolve.

At the moment it is only possible doing manually.

Any thoughts how to begin?

Thank you

To clarify, you want the scrip to check if there are any open child tickets, and if there are none (and one was just closed) then update the scrip?

No…

When I close an Incident all the childs will close automatically.
What I need is to enforce the same CF.Resolution on all the childs.

If I close an Incident with CF.Resolution False Positive, all the childs must have the same CF filled.

Ah that is more easy!

You can use the scrip condition “On Resolve”, and then a custom action. Something like this (need to test the code):

my $parent_resolution_value = $self->TicketObj->FirstCustomFieldValue( "Resolution" );
while (my $link = $self->TicketObj->DependedOnBy->Next) {
   my ($ret, $msg) = $link->AddCustomFieldValue( Field => "Resolution", Value => $parent_resolution_value );

    RT::Logger->error("Could not set resolution value: $msg") unless $ret;
}

return 1;

Thank you very much :heart:

I will test it

Hi knation

I have 2 issues on the scrip:

  • Does not find DependOnBy, I have to manually link the IR to Incident on DependOn field.
    I need the Children field, but does not recognize this field.

  • I have an error message " Couldn’t load custom field by ‘Resolution’ identifier"

Any thoughts?

Thank you

What does it find? I forget if DependedOn gives children tickets or others

I have an error message " Couldn’t load custom field by ‘Resolution’ identifier"

What is the name of your CF?

Supposedly the DependedOn gives the children tickets.

The name of my Custom Field is Resolution, the same error for others CF.

So what are you getting?

Empty values

I just can find values if manually fill the Depended on by field.

my $parent_resolution_value = $self->TicketObj->FirstCustomFieldValue( "Resolution" );

while (my $link = $self->TicketObj->Members->Next) {
   my ($ret, $msg) = $link->BaseObj->AddCustomFieldValue( Field => "Resolution", Value => $parent_resolution_value );

    RT::Logger->error("Could not set resolution value: $msg") unless $ret;
}

return 1;

Thank you very much :heart: