Summary:

When using the client-side API's addButton method, leaving out a parameter may result in a button not displaying correctly.

Symptoms:

Instead of a working button appearing, with the correct label, a button may display "[object Object]". If using the Sage theme, a placeholder will appear in place of the button's image.

Cause:

This issue is caused by incorrect parameters being passed to the addButton function. At the time of writing (February 2016), there is a small error in the addButton documentation available here:

http://help.sagecrm.com/js-api/classes/crm.html#method_addButton


Resolution:

The issue can be resolved by passing an image path as the first parameter. This still has to be done even if the Ergonomic theme is being used, since users may still be using the Sage theme.

The correct usage for addButton is as follows:

addButton ( imagePath, captionfamily, captioncode, linkURL, [Object.index] )

The function can be demonstrated in the example below:

crm.addButton("..\\\Themes/Img/color/Buttons/NewOrders.gif","GenCaptions","NewOrder",
{"index": 2,
"href": "#",
click: function(){
    window.open("http://www.sagecrm.com")
}
});

The issue has been raised to the Documentation team for resolution.