2

3

Every email reply begins with:

Hello Sarah,

Is there a snippet placeholder which would allow this? i.e.

Hello {firstname},

Browsing the questions here, it seems that there are undocumented snippets available.

I'm using FB on demand.

flag
Is there a way to get this to work on the "message template" / email signature? I'd like to be able to include the first name of the user in our default signature. – Jeremy Nov 15 2011 at 18:53

2 Answers

4

Here's my custom placeholders BugMonkey script:

name:          Custom Placeholders
description:   Adds some helpful values to the rgPlaceholders list.
author:        Rich Armstrong
version:       1.0.0.4

js:

$(function(){
  // if we're not on the case page, don't do anything
  if (!$('#bugviewContainer').length) return;

  /* To Title Case 1.1.1
   * David Gouch <http://individed.com>
   * 23 May 2008
   * License: http://individed.com/code/to-title-case/license.txt
   *
   * In response to John Gruber's call for a Javascript version of his script: 
   * http://daringfireball.net/2008/05/title_case
   */
  String.prototype.toTitleCase = function() {
    return this.replace(/([\w&`'‘’"“.@:\/\{\(\[<>_]+-? *)/g, function(match, p1, index, title) {
        if (index > 0 && title.charAt(index - 2) !== ":" &&
          match.search(/^(a(nd?|s|t)?|b(ut|y)|en|for|i[fn]|o[fnr]|t(he|o)|vs?\.?|via)[ \-]/i) > -1)
            return match.toLowerCase();
        if (title.substring(index - 1, index + 1).search(/['"_{(\[]/) > -1)
            return match.charAt(0) + match.charAt(1).toUpperCase() + match.substr(2);
        if (match.substr(1).search(/[A-Z]+|&|[\w]+[._][\w]+/) > -1 || 
          title.substring(index - 1, index + 1).search(/[\])}]/) > -1)
            return match;
        return match.charAt(0).toUpperCase() + match.substr(1);
    });
  };
  var addCustomPlaceholders = function(){
    if (!window.goBug) return;
    var oMyFirstName = new Object();
    oMyFirstName.sPlaceHolder = "{myfirstname}";
    var oMyLastName = new Object();
    oMyLastName.sPlaceHolder = "{mylastname}";
    var oMyName = new Object();
    oMyName.sPlaceHolder = "{myname}";
    oMyName.sValue = GetFullName(); // this placeholder already exists as {username}
    // I just did this for consistency.
    sMyName = GetFullName().match(/(\w+) (\w+)/);
    if (sMyName[1]) { 
      oMyFirstName.sValue = sMyName[1];
      oMyLastName.sValue = sMyName[2];
    }
    rgPlaceHolders.push(oMyFirstName);
    rgPlaceHolders.push(oMyLastName);
    if (window['goBug'] != undefined) {
       if (goBug.sCustomerEmail == "") {
            return;
       }
       var oFirstName = new Object();
       oFirstName.sPlaceHolder = "{firstname}";
       sFirstName = goBug.sCustomerEmail.match(/^"?(([\w'\-\(\)]+), )?([\w\'\-]+)( [\w'\-\(\)\.]+)*(, [SsJj]r.)?"? <[a-zA-Z0-9._+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}(\.[a-zA-Z]{2,4})?>$/);
       if (sFirstName) { 
       oFirstName.sValue = sFirstName[3].toTitleCase();
       } else {
         oFirstName.sValue = "[[name]]";
       }
       rgPlaceHolders.push(oFirstName);
    }
  } //end function addCustomPlaceholders
  addCustomPlaceholders();
});

It adds {name}, {myfirstname}, {mylastname}.

Notes:

  • If we don't know the first name, we replace with [[name]] which will be highlighted for you to replace.

Caveats:

  • Not tested in IE. Works in Chrome and Firefox.
  • Sometimes when we start typing, this script hasn't run yet.
  • Doesn't work with "Last, First" yet.
  • Is broken by names with accents in them.
  • Only works with snippets, not with autoresponses.
  • It pulls from the Correspondent every time. If others chime in, it'll still fill in the correspondent name.
link|flag
0

I think these are all available placeholders:

case ID: {case}
message subject: {subject}
FogBugz URL: {url}
external ticket: {ticket}
single case ticket: {ticket_singlecase}
external link: {ticketurl}
single case link: {ticketurl_singlecase}
sender email: {sender}
my name: {username}
my email: {useremail}
mailbox name: {fullname} (empty in snippets)
mailbox email: {email} (empty in snippets)

See also this question.

What undocumented snippets do you refer to?

Maybe you could use BugMonkey to hack something around {sender}...

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.