<p dir="ltr">I feel that you are overcomplicating your scrip by testing for a status change (which is actually a side effect of another scrip), because your primary goal is to perform this action when correspondence occurs.</p>
<p dir="ltr">If I were in your position, I would have two scrips in place:</p>
<p dir="ltr">1. On (correspond AND owner is absent AND ticket is stalled/resolved), set owner to Nobody. Runs first.</p>
<p dir="ltr">2. On correspond, open inactive tickets. Runs second.</p>
<p dir="ltr">Actually, in your position I would probably assign an additional "Exclusive" custom field to tickets that when set to true, indicates that the ticket can only be worked on by the current owner. Then I would change Scrip 1's condition to "on (correspond AND owner absent AND ticket not exclusive)." That way, the status isn't used to convey that meaning.</p>
<p dir="ltr">Custom fields can be loaded by name, so that shouldn't be failing for you. Is "absent" the exact name of the field? What is the exact code that you are using?</p>
<div class="gmail_quote">On 25/07/2014 12:44 am, "Eierschmalz, Bernhard" <<a href="mailto:Bernhard.Eierschmalz@scheppach.com">Bernhard.Eierschmalz@scheppach.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="DE" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">Hello Alex,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">I user RT 4.2.6<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">In my error logs I find the following:
<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><i><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">[3066] [Thu Jul 24 14:16:20 2014] [warning]: Couldn't load custom field by 'absent' identifier (/opt/rt4/sbin/../lib/RT/Record.pm:2231)<u></u><u></u></span></i></p>
<p class="MsoNormal" style="margin-left:35.4pt"><i><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">[3066] [Thu Jul 24 14:16:20 2014] [warning]: Use of uninitialized value in string eq at (eval 896) line 1. ((eval
896):1)<u></u><u></u></span></i></p>
<p class="MsoNormal" style="margin-left:35.4pt"><i><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">[3066] [Thu Jul 24 14:16:23 2014] [warning]: Couldn't load custom field by 'absent' identifier (/opt/rt4/sbin/../lib/RT/Record.pm:2231)<u></u><u></u></span></i></p>
<p class="MsoNormal" style="margin-left:35.4pt"><i><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">[3066] [Thu Jul 24 14:16:23 2014] [warning]: Use of uninitialized value in string eq at (eval 905) line 1. ((eval
905):1)</span></i><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">What does this mean? Should I identify the CF by ID?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">If I understand you correctly, the "on correspond, open inactive tickets" scrip is interfering with your ability to test whether an absent owner's ticket was previously marked as stalled or resolved rather than open.
If you move your scrip to execute before the scrip that opens inactive tickets on correspond, the interference should no longer occur.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">Not exactly. Let me explain once again.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">When a user is absent, he maybe has open tickets, and for sure has many resolved and stalled tickets.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">The open tickets are tickets, only this user can resolve, and this user decides to resolve this ticket after his absence. (e.g. because this is
a large project)<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">When there is any transaction (e.g. an answer from client or somebody) the owner of this ticket should not be changed (because the owner will resolve
it after his absence)<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">on open tickets the “on correspond, open inactive tickets” isn’t triggered, so the status doesn’t change, and my scrip doesn’t run<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">Now over to the resolved and stalled tickets: when there is any transaction on these tickets, user should be set to “nobody” to inform the other
colleagues about this tickets.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">On the transaction, firstly the “on correspond, open inactive tickets” is triggered and changes the state from stalled or resolved to “open”<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">Now my scrip triggers this status change and changes the user to “nobody”.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">I hope you can see my idea more clear now.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">best regards<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">Bernhard<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">Von:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Alex Peters [mailto:<a href="mailto:alex@peters.net" target="_blank">alex@peters.net</a>]
<br>
<b>Gesendet:</b> Donnerstag, 24. Juli 2014 16:11<br>
<b>An:</b> Eierschmalz, Bernhard<br>
<b>Cc:</b> <a href="mailto:rt-users@lists.bestpractical.com" target="_blank">rt-users@lists.bestpractical.com</a><br>
<b>Betreff:</b> Re: [rt-users] absence planning<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">There might be API inconsistency across RT versions. What version of RT are you using? Also, are you receiving any errors in RT's logs when that code runs?<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">If I understand you correctly, the "on correspond, open inactive tickets" scrip is interfering with your ability to test whether an absent owner's ticket was previously marked as stalled or resolved rather than open.
</span>If you move your scrip to execute before the scrip that opens inactive tickets on correspond, the interference should no longer occur.<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On 24 July 2014 23:56, Eierschmalz, Bernhard <<a href="mailto:Bernhard.Eierschmalz@scheppach.com" target="_blank">Bernhard.Eierschmalz@scheppach.com</a>> wrote:<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">So now I try:
</span><u></u><u></u></p>
<p class="MsoNormal" style="text-indent:35.4pt">
<i><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">return 1 if $self->TicketObj->FirstCustomFieldValue('absent') eq "yes";</span></i><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">But it still doesn’t work. What is wrong?</span><u></u><u></u></p>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"> </span><u></u><u></u></p>
<p class="MsoNormal" style="text-indent:35.4pt">
<span lang="EN-US">I don't understand why you are testing for a ticket status change. Wouldn't you want the scrip to run only when correspondence occurs?</span><u></u><u></u></p>
</div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">A user usually changes all his tickets to “stalled” or “resolved” when he’s absent.
When the user leaves tickets on “open” during his absence that means, nobody else can finish this ticket, only he can do it (e.g. on larger projects)</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">So when one of the stalled or resolved tickets receive an answer, the status is changed
and with my scrip the user will be nobody.</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">Best regards,</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a">Bernhard</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#44546a"> </span><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">Von:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Alex Peters [mailto:<a href="mailto:alex@peters.net" target="_blank">alex@peters.net</a>]
<br>
<b>Gesendet:</b> Donnerstag, 24. Juli 2014 15:33<br>
<b>An:</b> Eierschmalz, Bernhard<br>
<b>Cc:</b> <a href="mailto:rt-users@lists.bestpractical.com" target="_blank">rt-users@lists.bestpractical.com</a><br>
<b>Betreff:</b> Re: [rt-users] absence planning</span><u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">You can probably use:<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">$self->TicketObj->OwnerObj->FirstCustomFieldValue('absent')<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">to access the value of the owner's "absent" custom field.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I don't understand why you are testing for a ticket status change. Wouldn't you want the scrip to run only when correspondence occurs?<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> <u></u><u></u></p>
<div>
<p class="MsoNormal">On 24 July 2014 23:14, Eierschmalz, Bernhard <<a href="mailto:Bernhard.Eierschmalz@scheppach.com" target="_blank">Bernhard.Eierschmalz@scheppach.com</a>> wrote:<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Hello,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">I want to build some absence planning into our RT to avoid that absent users receive messages and nobody sees this message. What I’m planning is the following:</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p><span lang="EN-US">1.</span><span lang="EN-US" style="font-size:7.0pt"> </span>
<span lang="EN-US">Creating a user’s custom field “absent” which is yes or no</span><u></u><u></u></p>
<p><span lang="EN-US">2.</span><span lang="EN-US" style="font-size:7.0pt"> </span>
<span lang="EN-US">When a user is absence, this user changes this field to yes, when he’s back he changes back to no</span><u></u><u></u></p>
<p><span lang="EN-US">3.</span><span lang="EN-US" style="font-size:7.0pt"> </span>
<span lang="EN-US">When the status of one ticket with absent owner (where custom field value is “yes”) changes, the owner show be set to nobody (so the other colleagues can find the ticket</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">so I planned to set up this with a Scrip.</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">Scrip Action is easy. It’s
</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:35.4pt">
<i><span lang="EN-US">$self->TicketObj->SetOwner ( $RT::Nobody->id );</span></i><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:35.4pt">
<i><span lang="EN-US">Return 1;</span></i><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">What I’m having problems with is Scrip Condition.</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">For the first step, I tried to run the scrip on any update, so I only have to check whether the absent-CF is yes or no</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">I tried the following line:</span><u></u><u></u></p>
<p class="MsoNormal" style="text-indent:35.4pt">
<i><span lang="EN-US">return 1 if $self->TicketObj->Owner->Customfields->CustomFieldValue(‘absent’) eq “yes”;</span></i><u></u><u></u></p>
<p class="MsoNormal"><i><span lang="EN-US"> </span></i><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">but this isn’t working. What is wrong?</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">A second step will be to check, what exactly was changed (and only run if status was changed).</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">I think I can do this with
</span><u></u><u></u></p>
<p class="MsoNormal" style="text-indent:35.4pt">
<i><span lang="EN-US">return 0 unless $self->TransactionObj->Type eq “Status” </span>
</i><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">in front of the other code; am I right?</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal">Best regards,<u></u><u></u></p>
<p class="MsoNormal"><span style="color:#888888"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:#888888">Bernhard,</span><u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><br>
--<br>
RT Training - Boston, September 9-10<br>
<a href="http://bestpractical.com/training" target="_blank">http://bestpractical.com/training</a><u></u><u></u></p>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</blockquote></div>