December 4, 2013

Using COMCreateObject to debug scripts

COMCreateObject is one of the better ways  to debug scripts. Here is an example.

function BusComp_PreSetFieldValue(FieldName, FieldValue)
{
    if (FieldName == "Selected APTC")
    {
        //Instantiate
        var WshShell = COMCreateObject("WScript.Shell");
        
        //to display a custom message
        WshShell.Popup("In BusComp_PreSetFieldValue",0,"Siebel");
        
        var sSelectedAPTC = this.GetFieldValue("Selected APTC");
        
        //to display a variable value
        WshShell.Popup(sSelectedAPTC,0,"Siebel");
        
        //to display custom message with variable value
        WshShell.Popup("sSelectedAPTC= "+sSelectedAPTC,0,"Siebel");
        
        //nullify
        WshShell = null;
    }
}

Sample Example:



2 comments:

  1. Thank you, Praful!
    Quite unexpected way and quite useful.

    ReplyDelete
  2. It works in Developer client only (not in thin client) for a pity :(

    ReplyDelete