8

Can we make custom placeholders for use in snippets and auto-replies?

An example could be an auto-reply like this triggered by the users version of our software:

"Dear User, You have submitted a bug against an old version of our product. The bug might have been fixed in version {currentversion} which can be downloaded from {currentversionurl}"

... or something like that.

Fog Creek Case FC1838005

flag
1 
I think this is a feature request... and I second the motion. In addition to the email placeholders currently supported and the custom placeholders Nicolaj is requesting, I would like to see a placeholder for every Case field value. – PJM Jan 5 2010 at 18:16

2 Answers

3

We don't have anything like this now, but extensions to the plugin api may make it possible in the future. If you like this feature, then vote this question up.

link|flag
4

I fiddled around today and got custom placeholders working for us for first names in email. I put this in our BugMonkey script:

 if (goBug) {
   var oFirstName = new Object();
   oFirstName.sPlaceHolder = "{firstname}";
   sFirstName = goBug.sCustomerEmail.match(/"(\w+)[^,@]*?" <[a-zA-Z0-9._+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}>/);
   if (sFirstName) { 
     oFirstName.sValue = sFirstName[1];
   } else {
     oFirstName.sValue = "[[name]]";
   }
   rgPlaceHolders.push(oFirstName);
 }

If you then make a snippet that says:

Hi {firstname},

It will come out differently based on whether that regex pulled out a first name. Either this:

Hi Joel,

Or this:

Hi [[name]],

[[name]] will be automatically highlighted by FogBugz so that you can type in the person's name.

You could do this with any arbitrary value for the bug, or really anywhere in the DOM. We don't have a use for this, but I just threw together this one, which makes a placeholder for the number of BugzScout occurrences a bug has:

 if (goBug) {
   var oPlaceHolder = new Object();
   oPlaceHolder.sPlaceHolder = "{occurrences}";
   oPlaceHolder.sValue = (goBug.c + 1).toString();
   rgPlaceHolders.push(oPlaceHolder);
 }

If you wanted to have a value that got changed only infrequently, you could put a literal value in the Javascript of the page like this:

   var oPlaceHolder = new Object();
   oPlaceHolder.sPlaceHolder = "{currentversion}";
   oPlaceHolder.sValue = "FogBugz 8.0.26";
   rgPlaceHolders.push(oPlaceHolder);

Because autoreplies are generated without having loaded the user interface, the Javascript won't run. You're still limited to the built-in placeholders there.

link|flag

Your Answer

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