Rene Rubalcava | June 18, 2013
I see questions pop up once in a while about building a dynamic popup, but excluding some fields from showing up or adding a hyperlink. The classic way to do this is to write up the content of your popup ahead of time. There are a couple of examples of this in the developer samples.
I have a little utility module I wrote a while ago that has gone through numerous iterations, but it still serves its purpose. It's called templateBuilder and can be used to dynamically generate the content or used to build InfoTemplate content after a click event or something an IdentifyResult.
It will remove some common fields that are typically not viewed in a popup, like shape or objectid. It can take options that let you define a URL field and the URL prefix to go along with it. I'm tinkering with adding more advanced options for alias field names and formatting, but I think this is a good base to work from. I currently use this in just about every project that has popups, so I'm hoping someone will find it useful.