Custom Formatter in InforCRM Editable Grid

To add a link to another CRM entity in the SData Grid is easy, you just add a Link column.

However to add a link to an external web site you need to use a custom formatter. This is an Editable Field, with a “Custom Formatter” property specified. That is a Javascript function, but don’t let that scare you. Here is what it would look like:

function(url) {
  return '<a href="' + url + '">Go to wherever</a>'
}

If you want it to open in another window:

function(url) {
  return '<a href="' + url + '" target="_blank">Go to wherever</a>'
}

A few things to note:

  • If you want it to combine data from more than 1 fields, you have to retrieve the row first, so there is a little bit more code involved.
  • Your code will not be invoked at all if there is no data in the field. So you can’t have it return a “default value”
  • This works on 8.2 and below – I have not tested in 8.3
  • If you want to do the same in a “regular” data grid (the ones that are not sdata based), you can use a link column – specify the fields to use for the link in “DestinationBindFields” and the format in “DestinationFormatString”… The format could just be “{0}” if your field already has the URL

Leave a Reply

Your email address will not be published. Required fields are marked *