Can I Call Smart Object Method with Ajax? Custom Controls


Badge +3

Hello,

 

I am creating a custom control that is to retreive the number of tasks in a user's task list. I would like to call this method via an Ajax call but I am getting the following error:

 

Server Error

    Not Connected

at SourceCode.Hosting.Client.BaseAPI.BaseAPI.RemoteCall(String TypeName, String MethodName, Object[] Parameters, Boolean[] NullList, MarshalMessageType CallType)
at SourceCode.SmartObjects.Client.SmartObjectClientServer.GetSmartObject(String systemName)
at NavigationMenuCustomControl.MenuFolder.Handler.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

 

 

Am I unable to call a SmartObject method with Ajax or is there some configuration that needs to be done in order for it to work? 

 

Thanks,

 


2 replies

Userlevel 5
Badge +18

Is the control making a call to the SourceCode.Workflow.Client api?  Or are you using a Smartobject or something to return this count?


 


How the connection string look like?  Perhaps it was not able to connect to the server becuase the connetion string is malformed.

Badge +3

Hi tin, 

 

Thanks for the response. I am using a SmartObject to retreive the data. Here is a sample of my code:

 

                SmartObject workListSmartObject = serverName.GetSmartObject("SmartObjectName");
workListSmartObject.MethodToExecute = "GetWorklistItems";

SmartObjectList results = serverName.ExecuteList(workListSmartObject);

return results.SmartObjectsList.Count;

This code works correctly when I do not use an ajax call, but when I take this code and use it with an ajax call, I get the error. 

 

Thanks again,

Reply