It is possible to dynamically change the Coaching Captions displayed in a screen.

In the article "The control of Coaching Captions in a screen", I explained how coaching captions are stored in metadata and then displayed on the screen.

We saw in that article that a Coaching Caption is associated with a system action or a custom page in a predictable way.

The link is stored in the coachingcaptions table.

select * from coachingcaptions where Coch_ActionID = 'ActPageRebuild1RunMyCustomPageKey1'

And the actual text of the caption in the custom_captions table.

select * from Custom_Captions where capt_code = 'ActPageRebuild1RunMyCustomPageKey1'

It is possible to add your own coaching captions into the system. This is typically down using the Component Manager as it has specific API calls to support this.

The creation of Components is discussed in other articles in the community but the code would look like this:

Coaching captions that have been added or updated
Translations that have been added or updated
Captions['UK']='This is a caption';

Since it is possible to add your own additional Captions and as we saw in the article, "The control of Coaching Captions in a screen", the <iframe> responsible for the display of the Coaching Caption is easily identifiable, this means we can swap the Coaching Caption for any screen if needed.

This can be done using the Client Side API.

In the example below you can see that my custom page has been called and has been passed an additional parameter. See the article "Passing an additional parameter to a .NET dll or ASP page from tab and buttons."

My URL looks like this:


The Client Side API can read parameters like this. See the article "Reading additional custom parameters using the Client Side API."

And the coaching captions <iframe> can be can be addressed and they can be controlled.

For example

var contextInfo = crm.getArgs();
if (contextInfo.AltCaption == 'Y') {
var myframe = document.getElementById("CoachingCaptionFrame");
if (myframe) {
var myQueryString = crm.map2QueryString({ SID: contextInfo.SID, Act: "1696", Mode: "1", CLk: "T", FldCoachingActionID: "ActPageRebuild1RunMyCustomPageKey1", AAct: "432" });
var myURL = crm.installUrl() + "eware.dll/do?" + myQueryString.toString();
myframe.src = myURL;

Note: We need to check that:

  • the parameter passed to the page
  • and coaching captions have been defined for the page.

A script like this can be added into the page either as an external script file, contained within the custom content box or a screen, or contained within the code of the custom page.