<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Sorry, accidentally answered to Martin privately.<br>
<br>
<div class="moz-forward-container"><br>
<br>
-------- Forwarded Message --------
<table class="moz-email-headers-table" cellpadding="0"
cellspacing="0" border="0">
<tbody>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Subject:
</th>
<td>Re: [rt-users] RT worklfow with approvers, chosen from
list</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Date: </th>
<td>Mon, 21 Mar 2016 13:58:18 +0200</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">From: </th>
<td>zux <a class="moz-txt-link-rfc2396E" href="mailto:zux@pie-dabas.net"><zux@pie-dabas.net></a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">To: </th>
<td><a class="moz-txt-link-abbreviated" href="mailto:martin.wheldon@greenhills-it.co.uk">martin.wheldon@greenhills-it.co.uk</a></td>
</tr>
</tbody>
</table>
<br>
<br>
<pre>Hi, sorry if i'm missing something simple here.
I tried your suggestions
this
my $cf = $Ticket{TOP}->LoadCustomFieldByIdentifier("Manager");
gave me an error when saving template:
Couldn't compile template codeblock 'TOP': Bareword "TOP" not allowed
while "strict subs" in use at template line 2
So I tried adding {}
$cf = {$Ticket{TOP}->LoadCustomFieldByIdentifier("Manager")};
this one I could save, bet when creating a ticket, it gave this error in
log:
[10174] [Mon Mar 21 11:53:36 2016] [debug]: Workflow: yielding $cf =
Can't call method "LoadCustomFieldByIdentifier" on an undefined value at
template line 1.
Am i missing something?
Thanks
On 2016.03.21. 13:08, Martin Wheldon wrote:
> Hi Janus,
>
> Details of how to do this can be found in the documentation:
>
> <a class="moz-txt-link-freetext" href="https://docs.bestpractical.com/rt/4.4.0/RT/Ticket.html#LoadCustomFieldByIdentifier">https://docs.bestpractical.com/rt/4.4.0/RT/Ticket.html#LoadCustomFieldByIdentifier</a>
>
>
> You need to load the custom field before accessing its value,
> something like the following should work. Not tested I'm afraid.
>
> my $cf = $Ticket{TOP}->LoadCustomFieldByIdentifier("Manager");
> Owner: {$Ticket{TOP}}->FirstCustomFieldValue($cf->Name)}
>
>
> Best Regards
>
> Martin
>
> On 2016-03-21 10:25, zux wrote:
>> Hi,
>> i have been trying to create a workflow, i'll try to describe it here:
>> User A from group HR creates a new ticket in queue "New employee".
>> User A chooses a value from a custom field called "Manager", this is a
>> "Select one value" custom field with a drop down.
>> The values in custom field "Manager" are usernames of managers.
>> Now i would like to create an approval ticket, with owner - custom
>> field "Manager" value.
>>
>> I have tried, without success, this code in template:
>>
>> ===Create-Ticket: Jauns Darbinieks
>> Subject: New employee {$Tickets{'TOP'}->Subject}
>> Depended-On-By: {$Tickets{'TOP'}->Id}
>> Queue: ___Approvals
>> Type: approval
>> Owner: {$Ticket{TOP}->FirstCustomFieldValue('Manager')}
>>
>> I get this error:
>> Owner: Can't call method "FirstCustomFieldValue" on an undefined value
>> at template line 6.
>>
>> How do i correctly forward the value of that custom field?
>>
>> The question also relates to the next part of my workflow. After the
>> manager approves the ticket, i would like to create 2-3 more tickets.
>> And each one of them would need to get some custom fields from the
>> parent ticket (but not all)
>> something like this - It would get a ticket with the username and what
>> computer should be given
>> security would also get a ticket with info about access restrictions
>> accounting would get some other info, that security and it should not
>> be able to see
>>
>> How do i correctly forward these custom fields to children tickets?
>> ---------
>> RT 4.4 and RTIR Training Sessions <a class="moz-txt-link-freetext" href="https://bestpractical.com/training">https://bestpractical.com/training</a>
>> * Washington DC - May 23 & 24, 2016
> ---------
> RT 4.4 and RTIR Training Sessions <a class="moz-txt-link-freetext" href="https://bestpractical.com/training">https://bestpractical.com/training</a>
> * Washington DC - May 23 & 24, 2016
</pre>
<br>
</div>
<br>
</body>
</html>