Platform API TestAPI.htm

(imported topic written by SystemAdmin)

Hey everyone,

So I’ve been trying to get a simple function in the TestAPI.htm to work just to test out the TEM Platform API. I’m simply just trying to stop an open action with the actionstopper methods. I modified a button in TestAPI.htm to execute the following code:

function StopAction()

{

// Create the BESAPI.ActionStopper object.

var actionStopper = new ActiveXObject(“BESAPI.ActionStopper”);

actionStopper.SetDSN(“bes_bfenterprise”);

actionStopper.StopAction(701,“username”,“password”);

window.document.execCommand(“Refresh”);

alert(“made it”);//to make sure it reaches the end of the function

}

However, when I open TestAPI.htm in internet explorer and hit the button all I get is my alert saying “made it”. I check the console’s action that I wanted to stop, and the action is still open.

Thanks in advance everyone,

Ilithis

(imported comment written by BenKus)

You might want to see if an error was thrown with a try/catch block…

Ben

(imported comment written by SystemAdmin)

Ben,

I input a simple try/catch around the entire function. When I ran the code no alert box showed up to indicate there were any errors.

function StopAction() {

try {

// Create the BESAPI.ActionStopper object.

var actionStopper = new ActiveXObject(“BESAPI.ActionStopper”);

actionStopper.SetDSN(“bes_EnterpriseServer”);

actionStopper.StopAction(701, “username”, “password”);

window.document.execCommand(“Refresh”);

alert(“made it”);//to make sure it reaches the end of the function

}

catch (e) {

alert(e);

}

}

Do you have any other ideas why the code is not executing properly to stop the action?

Happy Friday,

Ilithis

(imported comment written by Lee Wei)

I am going to take a guess.

You can print the message from actionStopper.DiagnosticMessage, as in:

alert(actionStopper.DiagnosticMessage);

If there are any errors, it will be shown there.

Lee Wei

(imported comment written by SystemAdmin)

Thanks for the input Lee and Ben (thus far).

I put the line of code:

alert(actionStopper.DiagnosticMessage);

towards the end of the function in multiple places. Once inside the catch part, and another outside the catch block.

function StopAction() {

try {

// Create the BESAPI.ActionStopper object.

var actionStopper = new ActiveXObject(“BESAPI.ActionStopper”);

actionStopper.SetDSN(“bes_EnterpriseServer”);

actionStopper.StopAction(701, “username”, “password”);

window.document.execCommand(“Refresh”);

alert(actionStopper.DiagnosticMessage);

}

catch (e) {

alert(e);

alert(actionStopper.DiagnosticMessage);

}

}

The only problem is that the alert window that appears gives me no information, it is just a blank window with the okay button at the bottom.

Any other ideas, anyone?

Thanks,

Ilithis

(imported comment written by SystemAdmin)

Problem fixed! It was not this code after all. The registry key paths for the signing keys was incorrect. I’m sorry that I overlooked the registry keys and instantly blamed the code. Thanks again Ben and Lee for your input on this thread.

Best,

Ilithis

(imported comment written by Lee Wei)

Thanks for letting us know.

(imported comment written by SystemAdmin)

Hey all,

I ran into another problem, this time in the BESAPI.FixletMessage area. I’m trying to get properties from a fixlet just to test things out.

function Load() {

try {

var fm = new ActiveXObject(“BESAPI.FixletMessage”);

fm.Load(1,325, “username”, “password”);

alert(fm.DiagnosticMessage);

var siteid = fm.Name();

alert(“3”);

} catch (e) {

alert(e);

}

}

What happens when I run the function is the alert with the diagnostic message is empty, which should mean that the Load command worked, but I never get the “3” alert, so something is going wrong with the fm.Name() line. The try-catch block picks up the error and alerts me that an:

object error

has occurred. I was wondering if anyone can shed any light on this.

Thanks,

Ilithis