Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Content of %{message} variable in ticket assignment

I'm customizing our ticket assignment alerts under Emails>Templates>Ticket Assignment Alert. Basically we want the assignee to be able to see the ticket details via email.

Ticket Assignment Alert
%{assignee},

Ticket #%{ticket.number} has been assigned to you by %{assigner}
----------------------
%{comments}
----------------------

New ticket #%{ticket.number} created.
-----------------------
Name: %{ticket.name}
Email: %{ticket.email}
Subject: %{ticket.subject}

%{message}

-----------------------

Login to view complete details...

%{ticket.staff_link}


Actual email they receive
Name,

Ticket #191188 has been assigned to you by SYSTEM (Auto Assignment)
----------------------
Auto Assignment
----------------------

New ticket #191188 created.
-----------------------
Name: Name
Email: email@domain.com
Subject: Ticket subject entered here

%{message}

-----------------------

Login to view complete details...

http://staff-ticket-url


I'm looking for a way to either use the %{message} variable or gain the equivalent functionality for Ticket Assignment Alerts.

Comments

  • casem;38390 said:
    I'm customizing our ticket assignment alerts under Emails>Templates>Ticket Assignment Alert. Basically we want the assignee to be able to see the ticket details via email.

    Ticket Assignment Alert
    %{assignee},

    Ticket #%{ticket.number} has been assigned to you by %{assigner}
    ----------------------
    %{comments}
    ----------------------

    New ticket #%{ticket.number} created.
    -----------------------
    Name: %{ticket.name}
    Email: %{ticket.email}
    Subject: %{ticket.subject}

    %{message}

    -----------------------

    Login to view complete details...

    %{ticket.staff_link}


    Actual email they receive
    Name,

    Ticket #191188 has been assigned to you by SYSTEM (Auto Assignment)
    ----------------------
    Auto Assignment
    ----------------------

    New ticket #191188 created.
    -----------------------
    Name: Name
    Email: email@domain.com
    Subject: Ticket subject entered here

    %{message}

    -----------------------

    Login to view complete details...

    http://staff-ticket-url


    I'm looking for a way to either use the %{message} variable or gain the equivalent functionality for Ticket Assignment Alerts.

    If you review the code I have posted for the MOD regarding Closed Ticket Alerts - you should be able to do what you want. Use the function postReply and which includes alerting assignee in that function. Warning in advance that it is a large modification but works great. IMHO.

    http://osticket.com/forums/showthread.php?t=13764
  • Sturg2013;38511 said:
    If you review the code I have posted for the MOD regarding Closed Ticket Alerts - you should be able to do what you want. Use the function postReply and which includes alerting assignee in that function. Warning in advance that it is a large modification but works great. IMHO.

    http://osticket.com/forums/showthread.php?t=13764
    On the other hand - it just be your template because this functionality was greatly improved in 1.7ST. There are three alerts for an assignee - the first alert is the Assignment Alert - that tells them that they have been assigned a ticket and posts the comments from the manager - here is my template:


    Do not reply to this email.
    To view/respond to the ticket, please login to the support ticket system.
    %{ticket.staff_link}

    %{assignee},

    %{assigner} has assigned ticket #%{ticket.number} to you!

    ----------------------

    Name: %{ticket.name}
    Email: %{ticket.email}
    Dept: %{ticket.dept.name}

    Status: %{ticket.status}

    Assigned: %{ticket.assigned}
    Assigned By: %{assigner}
    Message: %{comments}
    ----------------------



    Then there is the postMessage function that is used when the customer replies to their own ticket. I believe that already has a proper check for '$this->isAssigned()'

    Here is my check in that function


    //Insert message from client
    function postMessage($vars, $origin='', $alerts=true) {
    global $cfg;

    //Strip quoted reply...on emailed replies
    if(!strcasecmp($origin, 'Email')
    && $cfg->stripQuotedReply()
    && ($tag=$cfg->getReplySeparator()) && strpos($vars['message'], $tag))
    if(list($msg) = split($tag, $vars['message']))
    $vars['message'] = $msg;

    if($vars['ip'])
    $vars['ip_address'] = $vars['ip'];
    elseif(!$vars['ip_address'] && $_SERVER['REMOTE_ADDR'])
    $vars['ip_address'] = $_SERVER['REMOTE_ADDR'];

    $errors = array();
    if(!($message = $this->getThread()->addMessage($vars, $errors)))
    return null;

    $this->setLastMsgId($message->getId());

    if (isset($vars['mid']))
    $message->saveEmailInfo($vars);

    if(!$alerts) return $message; //Our work is done...

    $autorespond = true;
    if ($autorespond && $message->isAutoResponse())
    $autorespond=false;

    $this->onMessage($autorespond); //must be called b4 sending alerts to staff.

    $dept = $this->getDept();

    if(!$dept || !($tpl = $dept->getTemplate()))
    $tpl= $cfg->getDefaultTemplate();

    if(!($email=$cfg->getAlertEmail()))
    $email =$cfg->getDefaultEmail();

    //If enabled...send alert to staff (New Message Alert)
    if($cfg->alertONNewMessage() && $tpl && $email && ($msg=$tpl->getNewMessageAlertMsgTemplate())) {

    $msg = $this->replaceVars($msg, array('message' => $message));

    //Build list of recipients and fire the alerts.
    $recipients=array();
    //Last respondent.
    if($cfg->alertLastRespondentONNewMessage() || $cfg->alertAssignedONNewMessage())
    $recipients[]=$this->getLastRespondent();

    //Assigned staff if any...could be the last respondent

    if($this->isAssigned() && ($staff=$this->getStaff()))
    $recipients[]=$staff;

    //Dept manager
    if($cfg->alertDeptManagerONNewMessage() && $dept && ($manager=$dept->getManager()))
    $recipients[]=$manager;

    //Sturg2013 - Only alerts dept members if the ticket is NOT assigned.
    if($cfg->alertDeptMembersONNewMessage() && !$this->isAssigned() && !$this->isClosed()) {
    if(($members=$dept->getMembers()))
    $recipients=array_merge($recipients, $members);
    }


    $sentlist=array(); //I know it sucks...but..it works.
    foreach( $recipients as $k=>$staff) {
    if(!$staff || !$staff->getEmail() || !$staff->isAvailable() || in_array($staff->getEmail(), $sentlist)) continue;
    $alert = str_replace('%{recipient}', $staff->getFirstName(), $msg['body']);
    $email->sendAlert($staff->getEmail(), $msg['subj'], $alert);
    $sentlist[] = $staff->getEmail();
    }
    }

    return $message;
    }



    And Third there is the function postReply() alert that the Assignee gets when staff may reply. I have my modified my osTicket set up so that if a ticket is assigned - and someone from the dept replies OTHER than the assignee - the assignee gets an update. I choose not to update the assignee via email if the assignee is the one who is answering - that is redundant.

    That check is in the code / from the link that I provided in my previous answer.

    Hope it helps.
  • casem;38390 said:
    I'm customizing our ticket assignment alerts under Emails>Templates>Ticket Assignment Alert. Basically we want the assignee to be able to see the ticket details via email.
    After re-reading your original post I am not sure I have been helpful. I see what you are trying to do. Using an autoassignment method - not sure how you determine that - probably doesn't matter at this time - but I digress I think you are need to put the autoassign feature when a NEW ticket gets created so you can attach the message variable as it already exists when the new ticket alert is generated.

    In my osTicket when a ticket is opened and is not assigned - all the dept members are alerted via email with the %message. Then if I assign it - the dept member will A) already have an email or B) get notified of their assignment and be able to go back in email. or C) login to get the details. In either case - the communication is available to all dept members until the ticket is assigned. I also notify the dept of ticket closures regardless of assigned - which is what I started with in this thread. Ok. Over and out.
Sign In or Register to comment.