AddRequestor: Difference between revisions
Jump to navigation
Jump to search
m (2 revisions imported) |
|||
Line 9: | Line 9: | ||
* Create a custom field (user account) with the list of mail to add to the ticket as Requestor. (Do it for all client). | * Create a custom field (user account) with the list of mail to add to the ticket as Requestor. (Do it for all client). | ||
Login as root : | |||
Configuration -> Custom Field -> new Custom Field | |||
Name : othermail | |||
Description : the list of another e-mail user of the same enterprise | |||
Type : Enter Multiple Value | |||
Applies to : Users | |||
Validation : | |||
Enable : x | |||
Link value to : | |||
include page : | |||
* On Ticket Creation : auto add the list of e-mails as Requestor | * On Ticket Creation : auto add the list of e-mails as Requestor | ||
Login as root : | |||
Configuration -> Global -> Scrips -> new Scrip | |||
Description : AddOwnerForEntreprises | |||
Condition : On Create | |||
Action : User Defined | |||
Template : Global Template : Blank | |||
Stage : TransactionCreate | |||
Custom conditions : | |||
Return 1; | |||
Custom action preparation code: | |||
# Get Current Ticket | |||
my $T_Obj = $self->TicketObj; | |||
my $Email_Rq = $T_Obj->RequestorAddresses; | |||
# Set objet for User and Other | |||
my $U_Obj = RT::User->new($RT::SystemUser); | |||
my $O_Obj = RT::User->new($RT::SystemUser); | |||
$U_Obj->LoadByEmail($Email_Rq); | |||
my $cf_name="othermail"; | |||
my $others=$U_Obj->FirstCustomFieldValue($cf_name); | |||
#if the field contiens lot of mails (separated by ",") | |||
$others =~ s/\n//g; #(remove \n) | |||
my @other_list=split(/,/,$others); | |||
#param request-field to add Other | |||
my $Rq_Obj = $T_Obj->Requestors; | |||
my $other_id; | |||
my $other_mail; | |||
foreach $other_mail (@other_list) | |||
{ | |||
# get the user via email address | |||
$O_Obj->LoadByEmail($other_mail); | |||
# get Id | |||
$other_id = $O_Obj->Id; | |||
# Add user | |||
$Rq_Obj->AddMember($other_id); | |||
} | |||
return 1; | |||
Custom action cleanup code: | Custom action cleanup code: | ||
return 1; | return 1; | ||
== Example == | == Example == |
Latest revision as of 07:46, 23 August 2017
Problem
We have clients with more than one contact in them enterprises.
All clients of a same enterprise want to see the tickets.
Solution
- Create a custom field (user account) with the list of mail to add to the ticket as Requestor. (Do it for all client).
Login as root : Configuration -> Custom Field -> new Custom Field Name : othermail Description : the list of another e-mail user of the same enterprise Type : Enter Multiple Value Applies to : Users Validation : Enable : x Link value to : include page :
- On Ticket Creation : auto add the list of e-mails as Requestor
Login as root : Configuration -> Global -> Scrips -> new Scrip Description : AddOwnerForEntreprises Condition : On Create Action : User Defined Template : Global Template : Blank Stage : TransactionCreate
Custom conditions :
Return 1;
Custom action preparation code:
# Get Current Ticket my $T_Obj = $self->TicketObj; my $Email_Rq = $T_Obj->RequestorAddresses;
# Set objet for User and Other my $U_Obj = RT::User->new($RT::SystemUser); my $O_Obj = RT::User->new($RT::SystemUser);
$U_Obj->LoadByEmail($Email_Rq);
my $cf_name="othermail"; my $others=$U_Obj->FirstCustomFieldValue($cf_name);
#if the field contiens lot of mails (separated by ",") $others =~ s/\n//g; #(remove \n) my @other_list=split(/,/,$others);
#param request-field to add Other my $Rq_Obj = $T_Obj->Requestors; my $other_id; my $other_mail; foreach $other_mail (@other_list) { # get the user via email address $O_Obj->LoadByEmail($other_mail);
# get Id $other_id = $O_Obj->Id;
# Add user $Rq_Obj->AddMember($other_id); }
return 1;
Custom action cleanup code: return 1;
Example
user1 (user1@test.com), user2 (user2@test.com) and user3 (user3@test.com) are in the same entreprise
on the CF "othermail" of user1 user2@test.com, user3@test.com
and
on the CF "othermail" of user2 : user1@test.com, user3@test.com
and
on the CF "othermail" of user3 : user1@test.com, user2@test.com
when user1 create a ticket, user2 and user3 can view the ticket