Question

Returning List from Endpoints Assembly with Properties

  • 12 December 2022
  • 3 replies
  • 30 views

Badge +1

We have an Endpoints assembly method returning List of Objects, however when we try to create a K2 Listview based on it or execute method directly using SmartObjects tester tool then it does not return properties in clear format i.e., properties wise tabular format with columns.

Below is sample defination of the method, is there anything missing here?

 public static List<ERPTasks> GetListOfObjects (string userEmail)
{
List<ERPTasks> listErpTasksObjects=new List<ERPTasks>();

ERPTasks _obj = new ERPTasks();

_obj.AssignmentDate = "1/1/2022";
_obj.TaskTitle = "Tasks 1";

listErpTasksObjects.Add(_obj);

_obj = new ERPTasks();

_obj.AssignmentDate = "2/1/2022";
_obj.TaskTitle = "Tasks 2";

listErpTasksObjects.Add(_obj);


return listErpTasksObjects;
}

 


3 replies

Badge +12

What is the definition of ERPTasks and what do the results look like when you execute the SmartObject?

Badge +1

Thanks @tbyrne777 , below is the definition of the ERPTasks as requested.

 public class ERPTasks
{
public string TaskTitle;
public string AssignmentDate;
}

and below is the result currently when we execute using the tester tool. we can see the data part of result sbut somehow it’s not returned as columns that we want so that we can develop K2 ListView based on it.

ERPTasks (ERPTasks)
{"$type":"MHCMAPICLientLibrary2.ERPTasks, MHCMAPICLientLibrary2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null","TaskTitle":"Tasks 2","AssignmentDate":"2/1/2022"}
{"$type":"MHCMAPICLientLibrary2.ERPTasks, MHCMAPICLientLibrary2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null","TaskTitle":"Tasks 1","AssignmentDate":"1/1/2022"}

 

Badge +12

That is strange behavior considering how simple your ERPTasks class is - what version of the K2 Platform are you running? Do you have a WCF endpoint available that you can try to use to call this function instead of the Assembly endpoint? I’ve had a much better experience with WCF Service Instances and it may be easier to troubleshoot if the problem persists

Reply