https://rt-wiki.bestpractical.com/index.php?title=ApprovalCreation&feed=atom&action=historyApprovalCreation - Revision history2024-03-28T13:05:17ZRevision history for this page on the wikiMediaWiki 1.37.2https://rt-wiki.bestpractical.com/index.php?title=ApprovalCreation&diff=185&oldid=prevAdmin: 12 revisions imported2016-04-06T20:03:15Z<p>12 revisions imported</p>
<p><b>New page</b></p><div>= Creating Approvals In RT =<br />
<br />
== Using the CreateTicket action ==<br />
<br />
The key to creating an Approval is the [[CreateTicket]] event. To make a queue use the approval system, you need to create a Scrip to be triggered when the ticket is created. This scrip will cause a [[CreateTicket]] action to occur, using data from a custom template.<br />
<br />
== Expected Results of using the Approvals queues. ==<br />
<br />
The book says that approvals do 3 things automatically:<br />
<br />
* A ticket cannot be closed until all of its approvals are resolved.<br />
* If rejected, its original ticket (and all other approvals) are rejected.<br />
* When an approval-ticket is resolved/rejected comments are attached to the original ticket.<br />
<br />
== Defining the template ==<br />
<br />
All the juice behind an Approval is stored in a template. Create a new custom template local to your queue, and define the new template to look something like this :<br />
<br />
<code><br />
===Create-Ticket: codereview<br />
Subject: Code review for {$Tickets{'TOP'}->Subject}<br />
Depended-On-By: {$Tickets{'TOP'}->Id}<br />
Queue: ___Approvals<br />
Type: approval<br />
Content: Someone has created a ticket. you should review and approve it, so they can finish their work<br />
ENDOFCONTENT<br />
</code><br />
<br />
<u>_NOTE:_</u> There is an error in the documentation for RT3. This caused me a good bit of trouble. The Depended-On-By line in the documentation example is incorrect. The value on this line must be "TOP" (as shown here) and not "{$Tickets{'TOP'}-&gt;Id}" as the docs show.<br />
<br />
<u>_2nd NOTE:_</u> In RT 3.2.0 this is fixed and you must use "{$Tickets{'TOP'}-&gt;Id}" because just using "TOP" does not properly build the link. Also in template your template you need "Queue: Queuename" or RT will tell you it can't assign the ticket to a queue.<br />
<br />
<u>_3rd NOTE:_</u> In RT 3.4.0rc1 you must use "TOP". Also default Approvals queue name is <code>___Appovals</code> that you have to enable first and rename it to just "Approvals" or the above template will not work.<br />
<br />
<u>_4th NOTE:_</u> In RT 3.6.0 I had to use the following 2 lines in the template, <code>{$Tickets{'TOP'}-&gt;Id()}</code> and <code>Refers-To: {$Tickets{'TOP'}-&gt;Id()}</code>. Another thing that has not been mentioned is the permissions. I had to give the person who will be approving the tickets the following grants: [=[[ModifyTicket]]], [=[[OwnTicket]]], [=[[ShowTicket]]].<br />
<br />
<u>_5th NOTE:_</u> In the book "RT Essentials" this topic is described on page 94. The sample scripts there show the Depended-On-By: and Depends-On: commands within the Content area, which does not work. Moving them above the Content: area works correctly. [This has bitten me twice and I hope putting it here will prevent me from suffering a third time :)]<br />
<br />
The dependencies between the tickets will force the Approval ticket to be closed before the original ticket can be written off.<br />
<br />
== Approvals Notification And Permissions ==<br />
<br />
If you want different groups of people to have access to different sets of approvals, you will need to set up a few new Queues. No Ticket of type "Approval" will appear in the normal ticket lists, but tickets of this type from any Queue will be shown on the Approvals page. By managing your permissions, you can set up Approval systems for various organisational departments.<br />
<br />
You'll need to give the people who are to approve things permissions to see tickets in the ___Approvals queue. You can do this by granting Global permissions on ticket roles (Owner, AdminCc, etc), or by granting them just on the ___Approvals queue. To find the admin page for the ___Approvals queue, check "include disabled queues" and search Queue name matches "Approvals".<br />
<br />
You'll want to grant [[ShowTicket]] to [[AdminCC]]'s (which ever role your template attaches the approving group to the approval ticket as). If the approval link isn't showing you may need to set Configuration &gt; Global &gt; Group Rights &gt; $mygroup &gt; [[ShowApprovalsTab]].<br />
<br />
== Group Approvals ==<br />
<br />
Sometimes you want to create tickets so that any one person from a group can approve it. One way to do that is as follows:<br />
<br />
Create a group that contains the list of users that can approve. In the Approval template, add an [[AdminCC]] field. This will contain the group, but you cannot just list the group name, unfortunately; that would just create an unprivileged user with the same name as the group. You have to list the group's Principal ID. I suppose you could find out what that is manually and enter it directly, but that's not very manageable. Instead, put some Perl code in the field as follows:<br />
<br />
AdminCC: {<br />
my $group_name = 'Group Name';<br />
my $groups = RT::Groups-&gt;new( $RT::SystemUser );<br />
<br />
$groups-&gt;LimitToUserDefinedGroups();<br />
$groups-&gt;Limit(<br />
'FIELD' =&gt; 'Name',<br />
'OPERATOR' =&gt; '=',<br />
'VALUE' =&gt; $group_name );<br />
$groups-&gt;First-&gt;Id;<br />
}<br />
<br />
This inserts the ID of the group named "Group Name" in the [[AdminCC]] field. Be sure to replace the group named "Group Name" with the appropriate name of your group.<br />
<br />
Now you need to modify permissions for the Queue that contains the Approval so that the [[AdminCC]] role can approve it.<br />
<br />
Now when you create a ticket with approvals, the approval will show the group name and all of its members in the [[AdminCC]] field, and anyone listed there can approve that ticket. If the user that approves it also takes it, then you can easily see in the original ticket's "Depends On" section who approved it. You can automate this via another scrip. Create the following scrip on the Approval queue:<br />
<br />
Condition: On Resolve<br />
Action: User Defined<br />
Template: Global Template: Blank<br />
Stage: Transaction Create<br />
Custom Action Preparation Code:<br />
my $Actor = $self-&gt;TransactionObj-&gt;CreatorObj-&gt;Id;<br />
if( $Actor != $self-&gt;TicketObj-&gt;OwnerObj-&gt;Id ) {<br />
$RT::Logger-&gt;info("Auto assign ticket #". $self-&gt;TicketObj-&gt;id ." to user #". $Actor );<br />
<br />
my ($status, $msg) = $self-&gt;TicketObj-&gt;SetOwner( $Actor );<br />
unless( $status ) {<br />
die "Error: $msg";<br />
}<br />
}<br />
return( 1 );<br />
<br />
One of the features of doing it this way is that you can continue to have a single Approval queue and different people can approve different tickets since the rights are based on the [[AdminCC]] role and not a specific user or group.</div>Adminhttps://rt-wiki.bestpractical.com/index.php?title=ApprovalCreation&diff=181&oldid=prev134.117.97.233: /* Defining the template */2011-09-12T16:42:41Z<p><span dir="auto"><span class="autocomment">Defining the template</span></span></p>
<p><b>New page</b></p><div>= Creating Approvals In RT =<br />
<br />
== Using the CreateTicket action ==<br />
<br />
The key to creating an Approval is the [[CreateTicket]] event. To make a queue use the approval system, you need to create a Scrip to be triggered when the ticket is created. This scrip will cause a [[CreateTicket]] action to occur, using data from a custom template.<br />
<br />
== Expected Results of using the Approvals queues. ==<br />
<br />
The book says that approvals do 3 things automatically:<br />
<br />
* A ticket cannot be closed until all of its approvals are resolved.<br />
* If rejected, its original ticket (and all other approvals) are rejected.<br />
* When an approval-ticket is resolved/rejected comments are attached to the original ticket.<br />
<br />
== Defining the template ==<br />
<br />
All the juice behind an Approval is stored in a template. Create a new custom template local to your queue, and define the new template to look something like this :<br />
<br />
<code><br />
===Create-Ticket: codereview<br />
Subject: Code review for {$Tickets{'TOP'}->Subject}<br />
Depended-On-By: {$Tickets{'TOP'}->Id}<br />
Queue: ___Approvals<br />
Type: approval<br />
Content: Someone has created a ticket. you should review and approve it, so they can finish their work<br />
ENDOFCONTENT<br />
</code><br />
<br />
<u>_NOTE:_</u> There is an error in the documentation for RT3. This caused me a good bit of trouble. The Depended-On-By line in the documentation example is incorrect. The value on this line must be "TOP" (as shown here) and not "{$Tickets{'TOP'}-&gt;Id}" as the docs show.<br />
<br />
<u>_2nd NOTE:_</u> In RT 3.2.0 this is fixed and you must use "{$Tickets{'TOP'}-&gt;Id}" because just using "TOP" does not properly build the link. Also in template your template you need "Queue: Queuename" or RT will tell you it can't assign the ticket to a queue.<br />
<br />
<u>_3rd NOTE:_</u> In RT 3.4.0rc1 you must use "TOP". Also default Approvals queue name is <code>___Appovals</code> that you have to enable first and rename it to just "Approvals" or the above template will not work.<br />
<br />
<u>_4th NOTE:_</u> In RT 3.6.0 I had to use the following 2 lines in the template, <code>{$Tickets{'TOP'}-&gt;Id()}</code> and <code>Refers-To: {$Tickets{'TOP'}-&gt;Id()}</code>. Another thing that has not been mentioned is the permissions. I had to give the person who will be approving the tickets the following grants: [=[[ModifyTicket]]], [=[[OwnTicket]]], [=[[ShowTicket]]].<br />
<br />
<u>_5th NOTE:_</u> In the book "RT Essentials" this topic is described on page 94. The sample scripts there show the Depended-On-By: and Depends-On: commands within the Content area, which does not work. Moving them above the Content: area works correctly. [This has bitten me twice and I hope putting it here will prevent me from suffering a third time :)]<br />
<br />
The dependencies between the tickets will force the Approval ticket to be closed before the original ticket can be written off.{{Infobox<br />
|Box title = Hardware/Software Request Form.<br />
|Row 1 title = Department:<br />
|Row 2 title = Item Description:<br />
|Row 3 title = Price and Source:<br />
|Row 4 title = Synopsis: Reason for purchase.<br />
Who to receive.<br />
Date required.<br />
<br />
|Row 6 title = Account}}<br />
<br />
== Approvals Notification And Permissions ==<br />
<br />
If you want different groups of people to have access to different sets of approvals, you will need to set up a few new Queues. No Ticket of type "Approval" will appear in the normal ticket lists, but tickets of this type from any Queue will be shown on the Approvals page. By managing your permissions, you can set up Approval systems for various organisational departments.<br />
<br />
Note that if you're using the default ___Approvals Queue for your approvals, you'll need to give the people who are to approve things permissions to see tickets in this queue (which you can only do by granting Global permissions.) You'll want to grant [[ShowTicket]] to [[AdminCC]]'s (which ever role your template attaches the approving group to the approval ticket as). If the approval link isn't showing you may need to set Configuration &gt; Global &gt; Group Rights &gt; $mygroup &gt; [[ShowApprovalsTab]].<br />
<br />
== Example using PO Requisition Approvals ==<br />
<br />
Create a '''PO-Req''' queue for PO Requisitions.. this is where the tickets get created which need approval. Enable this queue and add users who are allowed to submit PO Requisitions to this queue with necessary permissions.<br />
<br />
Create the following template named "Create Approval":<br />
<br />
<code><br />
===Create-Ticket: poreq<br />
Subject: Approve purchase order for {$Tickets{'TOP'}->Subject}<br />
Depended-On-By: TOP<br />
Queue: Approvals-PO<br />
Type: approval<br />
Owner: username-of-owner #note this is so that notifications work properly<br />
Content: Someone has created a purchase requisition. Please review and approve it, so they can spend some money.<br />
ENDOFCONTENT<br />
</code><br />
<br />
<br />
<br />
'''If''' you want multiple approvals, just add more "===Create-Ticket:" sections<br />
<br />
and the following Scrip:<br />
<br />
Description: Create PO Req approval<br />
Condition: On Create<br />
Action: Create Tickets<br />
Template: Create Approval<br />
Stage: TransactionCreate<br />
<br />
Create queue '''Approvals-PO''', and copy the templates and scrips from the [<u>__]Approvals queue. (Leave the [__</u>]Approvals queue disabled and its templates unaltered for future reference). The __Approvals queue is built in to the system. In order to see it, you must check the ''Include disabled queues in listing.'' check-box at the bottom of the ''Admin Queues Screen.''<br />
<br />
If you want an easy way to copy these templates/scrips.. I have none.. it was copy/paste. Be sure to replace NEWQUEUENUM in the script below with the number of the queue you created above.<br />
<br />
You could do this in Mysql with commands such as:<br />
<br />
insert into Scrips (Queue, Description, ScripCondition, ScripAction, ConditionRules, ActionRules, CustomIsApplicableCode,<br />
CustomPrepareCode, CustomCommitCode, Stage, Template, Creator, Created, LastUpdatedBy, LastUpdated) select NEWQUEUENUM,<br />
Description, ScripCondition, ScripAction, ConditionRules, ActionRules, CustomIsApplicableCode, CustomPrepareCode,<br />
CustomCommitCode, Stage, Template, Creator, Created, LastUpdatedBy, LastUpdated from Scrips where Queue=2;<br />
<br />
insert into Templates (Queue, Name, Description, Type, Language, TranslationOf, Content, LastUpdated, LastUpdatedBy, Creator,<br />
Created) select NEWQUEUENUM, Name, Description, Type, Language, TranslationOf, Content, LastUpdated, LastUpdatedBy, Creator,<br />
Created from Templates where Queue=2;<br />
<br />
Set the Reply Address and Comment Address to the email address of the "PO-Req" queue. This just makes sense.<br />
<br />
Enable this queue and add as AdminCCs the user(s) you wish to be the Approver(s).<br />
<br />
In the scrip for "When an approval ticket is created..." change the following condition from User Defined to "On Create".<br />
<br />
The "Approval Passed" Template says "Ticket Rejected" in the subject.. please change to "Ticket Approved". The "All Approvals Passed" Template says "Ticket Rejected" in the subject.. please change to "Ticket Approved".<br />
<br />
There you have it. Hope this helps.<br />
<br />
== Group Approvals ==<br />
<br />
Sometimes you want to create tickets so that any one person from a group can approve it. One way to do that is as follows:<br />
<br />
Create a group that contains the list of users that can approve. In the Approval template, add an [[AdminCC]] field. This will contain the group, but you cannot just list the group name, unfortunately; that would just create an unprivileged user with the same name as the group. You have to list the group's Principal ID. I suppose you could find out what that is manually and enter it directly, but that's not very manageable. Instead, put some Perl code in the field as follows:<br />
<br />
AdminCC: {<br />
my $group_name = 'Group Name';<br />
my $groups = RT::Groups-&gt;new( $RT::SystemUser );<br />
<br />
$groups-&gt;LimitToUserDefinedGroups();<br />
$groups-&gt;Limit(<br />
'FIELD' =&gt; 'Name',<br />
'OPERATOR' =&gt; '=',<br />
'VALUE' =&gt; $group_name );<br />
$groups-&gt;First-&gt;Id;<br />
}<br />
<br />
This inserts the ID of the group named "Group Name" in the [[AdminCC]] field. Be sure to replace the group named "Group Name" with the appropriate name of your group.<br />
<br />
Now you need to modify permissions for the Queue that contains the Approval so that the [[AdminCC]] role can approve it.<br />
<br />
Now when you create a ticket with approvals, the approval will show the group name and all of its members in the [[AdminCC]] field, and anyone listed there can approve that ticket. If the user that approves it also takes it, then you can easily see in the original ticket's "Depends On" section who approved it. You can automate this via another scrip. Create the following scrip on the Approval queue:<br />
<br />
Condition: On Resolve<br />
Action: User Defined<br />
Template: Global Template: Blank<br />
Stage: Transaction Create<br />
Custom Action Preparation Code:<br />
my $Actor = $self-&gt;TransactionObj-&gt;CreatorObj-&gt;Id;<br />
if( $Actor != $self-&gt;TicketObj-&gt;OwnerObj-&gt;Id ) {<br />
$RT::Logger-&gt;info("Auto assign ticket #". $self-&gt;TicketObj-&gt;id ." to user #". $Actor );<br />
<br />
my ($status, $msg) = $self-&gt;TicketObj-&gt;SetOwner( $Actor );<br />
unless( $status ) {<br />
die "Error: $msg";<br />
}<br />
}<br />
return( 1 );<br />
<br />
One of the features of doing it this way is that you can continue to have a single Approval queue and different people can approve different tickets since the rights are based on the [[AdminCC]] role and not a specific user or group.</div>134.117.97.233https://rt-wiki.bestpractical.com/index.php?title=ApprovalCreation&diff=179&oldid=prev83.244.202.4: /* Defining the template */2010-12-02T16:21:43Z<p><span dir="auto"><span class="autocomment">Defining the template</span></span></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 12:21, 2 December 2010</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l21">Line 21:</td>
<td colspan="2" class="diff-lineno">Line 21:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Subject: Code review for {$Tickets{'TOP'}->Subject}</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Subject: Code review for {$Tickets{'TOP'}->Subject}</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Depended-On-By: {$Tickets{'TOP'}->Id}</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Depended-On-By: {$Tickets{'TOP'}->Id}</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> Queue: <del style="font-weight: bold; text-decoration: none;">Approvals</del></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> Queue: <ins style="font-weight: bold; text-decoration: none;">___Approvals</ins></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Type: approval</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Type: approval</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Content: Someone has created a ticket. you should review and approve it, so they can finish their work</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Content: Someone has created a ticket. you should review and approve it, so they can finish their work</div></td></tr>
<!-- diff cache key bestpractical_mediawiki1459887241:diff::1.12:old-178:rev-179 -->
</table>83.244.202.4https://rt-wiki.bestpractical.com/index.php?title=ApprovalCreation&diff=178&oldid=prev83.244.202.4: /* Example using PO Requisition Approvals */2010-12-02T16:21:03Z<p><span dir="auto"><span class="autocomment">Example using PO Requisition Approvals</span></span></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 12:21, 2 December 2010</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l51">Line 51:</td>
<td colspan="2" class="diff-lineno">Line 51:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Create the following template named "Create Approval":</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Create the following template named "Create Approval":</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> <<del style="font-weight: bold; text-decoration: none;">nowiki</del>>===Create-Ticket: poreq</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <<ins style="font-weight: bold; text-decoration: none;">code</ins>></div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> Subject: Approve purchase order for {$Tickets{'TOP'}-<del style="font-weight: bold; text-decoration: none;">&gt;</del>Subject}</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> </ins>===Create-Ticket: poreq</div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> Subject: Approve purchase order for {$Tickets{'TOP'}-<ins style="font-weight: bold; text-decoration: none;">></ins>Subject}</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Depended-On-By: TOP</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Depended-On-By: TOP</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Queue: Approvals-PO</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Queue: Approvals-PO</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l59">Line 59:</td>
<td colspan="2" class="diff-lineno">Line 60:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Content: Someone has created a purchase requisition. Please review and approve it, so they can spend some money.</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Content: Someone has created a purchase requisition. Please review and approve it, so they can spend some money.</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> ENDOFCONTENT</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> ENDOFCONTENT</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> </del></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></<ins style="font-weight: bold; text-decoration: none;">code</ins>></div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> </del></<del style="font-weight: bold; text-decoration: none;">nowiki</del>></div></td><td colspan="2" class="diff-side-added"></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>'''If''' you want multiple approvals, just add more "===Create-Ticket:" sections</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>'''If''' you want multiple approvals, just add more "===Create-Ticket:" sections</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l71">Line 71:</td>
<td colspan="2" class="diff-lineno">Line 71:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Template: Create Approval</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Template: Create Approval</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Stage: TransactionCreate</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Stage: TransactionCreate</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> </del></div></td><td colspan="2" class="diff-side-added"></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Create queue '''Approvals-PO''', and copy the templates and scrips from the [<u>__]Approvals queue. (Leave the [__</u>]Approvals queue disabled and its templates unaltered for future reference). If you want an easy way to copy these templates/scrips.. I have none.. it was copy/paste.</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Create queue '''Approvals-PO''', and copy the templates and scrips from the [<u>__]Approvals queue. (Leave the [__</u>]Approvals queue disabled and its templates unaltered for future reference). If you want an easy way to copy these templates/scrips.. I have none.. it was copy/paste.</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l85">Line 85:</td>
<td colspan="2" class="diff-lineno">Line 84:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Created) select NEWQUEUENUM, Name, Description, Type, Language, TranslationOf, Content, LastUpdated, LastUpdatedBy, Creator,</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Created) select NEWQUEUENUM, Name, Description, Type, Language, TranslationOf, Content, LastUpdated, LastUpdatedBy, Creator,</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Created from Templates where Queue=2;</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Created from Templates where Queue=2;</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> </del></div></td><td colspan="2" class="diff-side-added"></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Set the Reply Address and Comment Address to the email address of the "PO-Req" queue. This just makes sense.</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Set the Reply Address and Comment Address to the email address of the "PO-Req" queue. This just makes sense.</div></td></tr>
<!-- diff cache key bestpractical_mediawiki1459887241:diff::1.12:old-177:rev-178 -->
</table>83.244.202.4https://rt-wiki.bestpractical.com/index.php?title=ApprovalCreation&diff=177&oldid=prev83.244.202.4: /* Defining the template */2010-12-02T16:19:26Z<p><span dir="auto"><span class="autocomment">Defining the template</span></span></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 12:19, 2 December 2010</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l17">Line 17:</td>
<td colspan="2" class="diff-lineno">Line 17:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>All the juice behind an Approval is stored in a template. Create a new custom template local to your queue, and define the new template to look something like this :</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>All the juice behind an Approval is stored in a template. Create a new custom template local to your queue, and define the new template to look something like this :</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><code></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> </ins><code></div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>===Create-Ticket: codereview</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> </ins>===Create-Ticket: codereview</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Subject: Code review for {$Tickets{'TOP'}->Subject}</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> </ins>Subject: Code review for <ins style="font-weight: bold; text-decoration: none;"> </ins>{$Tickets{'TOP'}->Subject}</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Depended-On-By: {$Tickets{'TOP'}->Id}</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> </ins>Depended-On-By: {$Tickets{'TOP'}->Id}</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Queue: Approvals</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> </ins>Queue: Approvals</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Type: approval</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> </ins>Type: approval</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Content: Someone has created a ticket. you should review and approve it, so they can finish their work</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> </ins>Content: Someone has created a ticket. you should review and approve it, so they can finish their work</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>ENDOFCONTENT</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> </ins>ENDOFCONTENT</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div></code></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> </ins></code></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><u>_NOTE:_</u> There is an error in the documentation for RT3. This caused me a good bit of trouble. The Depended-On-By line in the documentation example is incorrect. The value on this line must be "TOP" (as shown here) and not "{$Tickets{'TOP'}-&gt;Id}" as the docs show.</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><u>_NOTE:_</u> There is an error in the documentation for RT3. This caused me a good bit of trouble. The Depended-On-By line in the documentation example is incorrect. The value on this line must be "TOP" (as shown here) and not "{$Tickets{'TOP'}-&gt;Id}" as the docs show.</div></td></tr>
<!-- diff cache key bestpractical_mediawiki1459887241:diff::1.12:old-176:rev-177 -->
</table>83.244.202.4https://rt-wiki.bestpractical.com/index.php?title=ApprovalCreation&diff=176&oldid=prev83.244.202.4: /* Defining the template */2010-12-02T16:17:19Z<p><span dir="auto"><span class="autocomment">Defining the template</span></span></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 12:17, 2 December 2010</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l17">Line 17:</td>
<td colspan="2" class="diff-lineno">Line 17:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>All the juice behind an Approval is stored in a template. Create a new custom template local to your queue, and define the new template to look something like this :</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>All the juice behind an Approval is stored in a template. Create a new custom template local to your queue, and define the new template to look something like this :</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><<del style="font-weight: bold; text-decoration: none;">nowiki</del>></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><<ins style="font-weight: bold; text-decoration: none;">code</ins>></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>===Create-Ticket: codereview</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>===Create-Ticket: codereview</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Subject: Code review for {$Tickets{'TOP'}->Subject}</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Subject: Code review for {$Tickets{'TOP'}->Subject}</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l24">Line 24:</td>
<td colspan="2" class="diff-lineno">Line 24:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Type: approval</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Type: approval</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Content: Someone has created a ticket. you should review and approve it, so they can finish their work</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Content: Someone has created a ticket. you should review and approve it, so they can finish their work</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>ENDOFCONTENT <del style="font-weight: bold; text-decoration: none;"> </del></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>ENDOFCONTENT</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div></<del style="font-weight: bold; text-decoration: none;">nowiki</del>></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></<ins style="font-weight: bold; text-decoration: none;">code</ins>></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><u>_NOTE:_</u> There is an error in the documentation for RT3. This caused me a good bit of trouble. The Depended-On-By line in the documentation example is incorrect. The value on this line must be "TOP" (as shown here) and not "{$Tickets{'TOP'}-&gt;Id}" as the docs show.</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><u>_NOTE:_</u> There is an error in the documentation for RT3. This caused me a good bit of trouble. The Depended-On-By line in the documentation example is incorrect. The value on this line must be "TOP" (as shown here) and not "{$Tickets{'TOP'}-&gt;Id}" as the docs show.</div></td></tr>
<!-- diff cache key bestpractical_mediawiki1459887241:diff::1.12:old-175:rev-176 -->
</table>83.244.202.4https://rt-wiki.bestpractical.com/index.php?title=ApprovalCreation&diff=175&oldid=prev83.244.202.4: /* Defining the template */2010-12-02T16:12:01Z<p><span dir="auto"><span class="autocomment">Defining the template</span></span></p>
<p><b>New page</b></p><div>= Creating Approvals In RT =<br />
<br />
== Using the CreateTicket action ==<br />
<br />
The key to creating an Approval is the [[CreateTicket]] event. To make a queue use the approval system, you need to create a Scrip to be triggered when the ticket is created. This scrip will cause a [[CreateTicket]] action to occur, using data from a custom template.<br />
<br />
== Expected Results of using the Approvals queues. ==<br />
<br />
The book says that approvals do 3 things automatically:<br />
<br />
* A ticket cannot be closed until all of its approvals are resolved.<br />
* If rejected, its original ticket (and all other approvals) are rejected.<br />
* When an approval-ticket is resolved/rejected comments are attached to the original ticket.<br />
<br />
== Defining the template ==<br />
<br />
All the juice behind an Approval is stored in a template. Create a new custom template local to your queue, and define the new template to look something like this :<br />
<br />
<nowiki><br />
===Create-Ticket: codereview<br />
Subject: Code review for {$Tickets{'TOP'}->Subject}<br />
Depended-On-By: {$Tickets{'TOP'}->Id}<br />
Queue: Approvals<br />
Type: approval<br />
Content: Someone has created a ticket. you should review and approve it, so they can finish their work<br />
ENDOFCONTENT <br />
</nowiki><br />
<br />
<u>_NOTE:_</u> There is an error in the documentation for RT3. This caused me a good bit of trouble. The Depended-On-By line in the documentation example is incorrect. The value on this line must be "TOP" (as shown here) and not "{$Tickets{'TOP'}-&gt;Id}" as the docs show.<br />
<br />
<u>_2nd NOTE:_</u> In RT 3.2.0 this is fixed and you must use "{$Tickets{'TOP'}-&gt;Id}" because just using "TOP" does not properly build the link. Also in template your template you need "Queue: Queuename" or RT will tell you it can't assign the ticket to a queue.<br />
<br />
<u>_3rd NOTE:_</u> In RT 3.4.0rc1 you must use "TOP". Also default Approvals queue name is <code>___Appovals</code> that you have to enable first and rename it to just "Approvals" or the above template will not work.<br />
<br />
<u>_4th NOTE:_</u> In RT 3.6.0 I had to use the following 2 lines in the template, <code>{$Tickets{'TOP'}-&gt;Id()}</code> and <code>Refers-To: {$Tickets{'TOP'}-&gt;Id()}</code>. Another thing that has not been mentioned is the permissions. I had to give the person who will be approving the tickets the following grants: [=[[ModifyTicket]]], [=[[OwnTicket]]], [=[[ShowTicket]]].<br />
<br />
<u>_5th NOTE:_</u> In the book "RT Essentials" this topic is described on page 94. The sample scripts there show the Depended-On-By: and Depends-On: commands within the Content area, which does not work. Moving them above the Content: area works correctly. [This has bitten me twice and I hope putting it here will prevent me from suffering a third time :)]<br />
<br />
The dependencies between the tickets will force the Approval ticket to be closed before the original ticket can be written off.<br />
<br />
== Approvals Notification And Permissions ==<br />
<br />
If you want different groups of people to have access to different sets of approvals, you will need to set up a few new Queues. No Ticket of type "Approval" will appear in the normal ticket lists, but tickets of this type from any Queue will be shown on the Approvals page. By managing your permissions, you can set up Approval systems for various organisational departments.<br />
<br />
Note that if you're using the default ___Approvals Queue for your approvals, you'll need to give the people who are to approve things permissions to see tickets in this queue (which you can only do by granting Global permissions.) You'll want to grant [[ShowTicket]] to [[AdminCC]]'s (which ever role your template attaches the approving group to the approval ticket as). If the approval link isn't showing you may need to set Configuration &gt; Global &gt; Group Rights &gt; $mygroup &gt; [[ShowApprovalsTab]].<br />
<br />
== Example using PO Requisition Approvals ==<br />
<br />
Create a '''PO-Req''' queue for PO Requisitions.. this is where the tickets get created which need approval. Enable this queue and add users who are allowed to submit PO Requisitions to this queue with necessary permissions.<br />
<br />
Create the following template named "Create Approval":<br />
<br />
<nowiki>===Create-Ticket: poreq<br />
Subject: Approve purchase order for {$Tickets{'TOP'}-&gt;Subject}<br />
Depended-On-By: TOP<br />
Queue: Approvals-PO<br />
Type: approval<br />
Owner: username-of-owner #note this is so that notifications work properly<br />
Content: Someone has created a purchase requisition. Please review and approve it, so they can spend some money.<br />
ENDOFCONTENT<br />
<br />
</nowiki><br />
<br />
'''If''' you want multiple approvals, just add more "===Create-Ticket:" sections<br />
<br />
and the following Scrip:<br />
<br />
Description: Create PO Req approval<br />
Condition: On Create<br />
Action: Create Tickets<br />
Template: Create Approval<br />
Stage: TransactionCreate<br />
<br />
<br />
Create queue '''Approvals-PO''', and copy the templates and scrips from the [<u>__]Approvals queue. (Leave the [__</u>]Approvals queue disabled and its templates unaltered for future reference). If you want an easy way to copy these templates/scrips.. I have none.. it was copy/paste.<br />
<br />
You could do this in Mysql with commands such as:<br />
<br />
insert into Scrips (Queue, Description, ScripCondition, ScripAction, ConditionRules, ActionRules, CustomIsApplicableCode,<br />
CustomPrepareCode, CustomCommitCode, Stage, Template, Creator, Created, LastUpdatedBy, LastUpdated) select NEWQUEUENUM,<br />
Description, ScripCondition, ScripAction, ConditionRules, ActionRules, CustomIsApplicableCode, CustomPrepareCode,<br />
CustomCommitCode, Stage, Template, Creator, Created, LastUpdatedBy, LastUpdated from Scrips where Queue=2;<br />
<br />
insert into Templates (Queue, Name, Description, Type, Language, TranslationOf, Content, LastUpdated, LastUpdatedBy, Creator,<br />
Created) select NEWQUEUENUM, Name, Description, Type, Language, TranslationOf, Content, LastUpdated, LastUpdatedBy, Creator,<br />
Created from Templates where Queue=2;<br />
<br />
<br />
Set the Reply Address and Comment Address to the email address of the "PO-Req" queue. This just makes sense.<br />
<br />
Enable this queue and add as AdminCCs the user(s) you wish to be the Approver(s).<br />
<br />
In the scrip for "When an approval ticket is created..." change the following condition from User Defined to "On Create".<br />
<br />
The "Approval Passed" Template says "Ticket Rejected" in the subject.. please change to "Ticket Approved". The "All Approvals Passed" Template says "Ticket Rejected" in the subject.. please change to "Ticket Approved".<br />
<br />
There you have it. Hope this helps.<br />
<br />
== Group Approvals ==<br />
<br />
Sometimes you want to create tickets so that any one person from a group can approve it. One way to do that is as follows:<br />
<br />
Create a group that contains the list of users that can approve. In the Approval template, add an [[AdminCC]] field. This will contain the group, but you cannot just list the group name, unfortunately; that would just create an unprivileged user with the same name as the group. You have to list the group's Principal ID. I suppose you could find out what that is manually and enter it directly, but that's not very manageable. Instead, put some Perl code in the field as follows:<br />
<br />
AdminCC: {<br />
my $group_name = 'Group Name';<br />
my $groups = RT::Groups-&gt;new( $RT::SystemUser );<br />
<br />
$groups-&gt;LimitToUserDefinedGroups();<br />
$groups-&gt;Limit(<br />
'FIELD' =&gt; 'Name',<br />
'OPERATOR' =&gt; '=',<br />
'VALUE' =&gt; $group_name );<br />
$groups-&gt;First-&gt;Id;<br />
}<br />
<br />
<br />
This inserts the ID of the group named "Group Name" in the [[AdminCC]] field. Be sure to replace the group named "Group Name" with the appropriate name of your group.<br />
<br />
Now you need to modify permissions for the Queue that contains the Approval so that the [[AdminCC]] role can approve it.<br />
<br />
Now when you create a ticket with approvals, the approval will show the group name and all of its members in the [[AdminCC]] field, and anyone listed there can approve that ticket. If the user that approves it also takes it, then you can easily see in the original ticket's "Depends On" section who approved it. You can automate this via another scrip. Create the following scrip on the Approval queue:<br />
<br />
Condition: On Resolve<br />
Action: User Defined<br />
Template: Global Template: Blank<br />
Stage: Transaction Create<br />
Custom Action Preparation Code:<br />
my $Actor = $self-&gt;TransactionObj-&gt;CreatorObj-&gt;Id;<br />
if( $Actor != $self-&gt;TicketObj-&gt;OwnerObj-&gt;Id ) {<br />
$RT::Logger-&gt;info("Auto assign ticket #". $self-&gt;TicketObj-&gt;id ." to user #". $Actor );<br />
<br />
my ($status, $msg) = $self-&gt;TicketObj-&gt;SetOwner( $Actor );<br />
unless( $status ) {<br />
die "Error: $msg";<br />
}<br />
}<br />
return( 1 );<br />
<br />
<br />
One of the features of doing it this way is that you can continue to have a single Approval queue and different people can approve different tickets since the rights are based on the [[AdminCC]] role and not a specific user or group.</div>83.244.202.4