Self Service in Sage CRM v7.1 and earlier uses the COM API.

Much of the use of the API in Self Service is very similar to the creation of ASP pages as extensions to the main user interface.  

I have noted in previous articles the Self Service API is actually a separate API and the usage of the blocks can be different. This is because the Self Service environment does not use a CRM SID (Session ID) or context in the same way.  We can't use any API objects/methods that rely on this for building URLs. So we can't use eWare.Button(), eWare.GetTabs() eWare.URL() etc, and we certainly can't use the output mechanism of a typical application extension ASP page.  The article "COM API objects available in Self Service" is a fairly complete discussion objects available.

I have also discussed the control of Buttons in a previous article "Custom Buttons in Self Service".  But that article is very much about creating additional buttons that work like buttons in the main interface.

Generally default buttons can be controlled in much the same way as in the main COM API

The Default Button (Save/Change) of a block is controlled by the DisplayButton property.


var Button_Default="1", Button_Delete="2", Button_Continue="4";
var myBlock = CRM.GetBlock("BlockName");
myBlock.DisplayButton(Button_Default) = true;

Other behaviour of the buttons such as the relative positioning of the button group is controlled by the properties of the Container/EntryGroup that holds the button.

This includes the ButtonLocation and ButtonAlignment.

var Bottom=0, Left=1, Right=2, Top=3;
var myBlock = CRM.GetBlock("BlockName");
myBlock.ButtonLocation = Top;
myBlock.ButtonAlignment = Right;

These button properties can be set depending on the mode of the screen or based on whatever data condition you need.

For example you can force the display of image used for the default button or the text used on the default button

if (CRM.Mode==Edit)
myBlock.ButtonTitle = CRM.GetTrans("Button","save");
myBlock.ButtonImage = "save.gif"
myBlock.ButtonTitle = CRM.GetTrans("Button","edit");
myBlock.ButtonImage = "edit.gif"