Using undocumented JavaScript CAF methods


I needed to add a confirmation dialog to a DeleteRowButton (as I describe in ) so I created the following code in a Script Block to execute the row deletion to be called on the OnClick client-side event of a Async Command Icon:

// Send the actual ID of the DOM object as in
// deleteRoleButConfirmBefore(this,'#&#123;caf:cid("<control>")}');
// the confirmation is using the value in the innerHTML of the columnIndexOfDataForConfirmation td 
// element of the row
function deleteRoleButConfirmBefore(Role,columnIndexOfDataForConfirmation,ElementToBeRefreshed) &#123;

    if ( Role == null || == null || columnIndexOfDataForConfirmation == null ) return(false);
    // This will only work if the this object is at the bottom of the path table>tbody>tr>td (table is the 4th ancestor)
    // var theTable=CAF.model(;
    // var theRow=CAF.model(theTable.findParentItem(;  
    // This might break as CAF.Table.getTableIdFromRowId seems to a private method (does not appear on the documentation)
    var theRow      = CAF.model(CAF.Table.getTableIdFromRowId(;   
    if ( theRow == null ) return(false);
    var theTable    = CAF.model(CAF.Table.getTableIdFromRowId(;
    if ( theTable == null ) return(false);
    // innerText for IE, textContent for standards compliance 
    var theRoleName = theRow.element.cells[columnIndexOfDataForConfirmation].textContent ||
    if ( theRoleName == null ) return(false);
    if ( confirm("Are you sure want to delete the role \"" + theRoleName +"\"?") ) &#123;
        if ( ElementToBeRefreshed != null ) &#123; CAF.model(ElementToBeRefreshed).refresh(); };
    } else &#123;

My problem is that I am using the undocumented JavaScript CAF methods CAF.Table.getTableIdFromRowId and remove for which I cannot find any documentation but both have been mentioned in this forum by SAG staff.

Is it ok to use these functions? Where can I find their definitions?
Or do I risk the possibility of the code being broken in the next fixes or versions?

Why not just add another parameter into your function?

You have this comment:

can you extend the function to be:



That only removes one of the calls, I still have to use getTableIdFromRowId to get the row’s ID so I can use its ‘remove’ method.

There is an easier way to get the Row Model. Have a look at the Designer On-line help section called: ‘CAF.Table.Row.Model’


Would you mind supplying an example?

I tried CAF.Table.Row.Model.prototype.getControlId( on onClick Client-Side action of the button but it returns again the button ID and not the Row ID.

Thank you.

Oh boy, i owe you an apology. Your approach was correct and i’ve filed an internal defect to ensure that the APIs: getTableIdFromRowId and remove will be documented and supported.

Please accept my apologies.

That’s ok :wink:

At least I am on the right track. :slight_smile: