Skip to main content

 

 I get DeserializeToArray does not exist as a method of this SmartObject Instance when running

 

billSchedule.MethodToExecute = "DeserializeToArray";    

 

The "DeserializeToArray" method only shows up in the smart object list methods,  and not the smart objects methods.    

 

How am I supposed to retrieve a datatable from this smart object in code?

 

 

 

Can you post an section of your code? The method to Execute should work, however, you would need to call one of the ExecuteList methods provided on the API. He is a code snippet where I have wrote a SmartObject execution engine and check to see if the method I am executing is a list or not and handle appropriately.

 

var results = new SmartObjectList();

var isList = false;

isList = (from SmartListMethod m in smo.ListMethods
where m.Name == smo.MethodToExecute
select (true)).FirstOrDefault();

if (isList)
results = SmoServer.ExecuteList(smo);
else
results.SmartObjectsList.Add(SmoServer.ExecuteScalar(smo));

 

The part you are missing is most likley the ExecuteList. You can also validate that you are using the right method name by checking the SmartObject tester tool and viewing XML. There is an unrealized gotcha that gets a lot of people as the name you read (Display Name) isn't always the same as the name that K2 uses to execute the call (System Name).

 

Hope this helps.

 

S.


Hi Capz


 


Please follow the two links I have provided below, this links will give you further understanding of deserialization and serialization of arrays, objects in general.


 


1) k2 4.7 Developers Reference


https://help.k2.com/onlinehelp/k2blackpearl/DevRef/4.7/default.htm#Serialization_Deserialization.htm?Highlight=Deserialize%20To%20Array%20as%20a%20method%20of%20this%20SmartObject


 


2) k2 FIve (5.1) Developers Reference


http://help.k2.com/onlinehelp/k2five/devref/5.1/default.htm#SBrokers/SB-Serialization.htm?Highlight=Deserialize%20To%20Array%20%20as%20a%20method%20of%20this%20SmartObject


 


I hope the links will help erradicate the problem you facing about deserialization of Array.


 


K2 will not accept any liability for any issues arising from actions taken in respect of the information provided by any forum member.


 


 


 


 


Reply