Home > Forum > Actions > SDK CustomAction return data to ItemsList

SDK CustomAction return data to ItemsList
0

Hello Gurus
I'm trying to do such action:
In my VS solution, I have made CustomAction that gets data from an external system as a list. I would like to return that list to ItemsList in my workflow. I have code like this:

[ConfigEditableFormFieldID(DisplayName = "Pozycje nagłówka ", FormFieldTypes = WorkFlow.SDK.Objects.Enums.FormFieldTypes.ItemsList)]
public List<Nagl_OT> Lista_Poz { get; set; }

public class Nagl_OT
{
[ConfigEditableFormFieldID(DisplayName = "Numer SAT", FormFieldTypes = WorkFlow.SDK.Objects.Enums.FormFieldTypes.TextSingleLine)]
public string Sat_ID { get; set; }
[ConfigEditableFormFieldID(DisplayName = "Podnumer SAT", FormFieldTypes = WorkFlow.SDK.Objects.Enums.FormFieldTypes.TextSingleLine)]
public string Podnr_ID { get; set; }
[ConfigEditableFormFieldID(DisplayName = "Data dokumentu", FormFieldTypes = WorkFlow.SDK.Objects.Enums.FormFieldTypes.TextSingleLine)]
public string DataDok { get; set; }
[ConfigEditableFormFieldID(DisplayName = "Data odniesienia", FormFieldTypes = WorkFlow.SDK.Objects.Enums.FormFieldTypes.TextSingleLine)]
public string DataOdn { get; set; }

}

In Run() I put records from an external system to Lista_Poz. In Designer Studio I have created Items List with columns like in Nagl_OT.

When I call my action in the workflow I get an error:Invalid cast from 'System.String' to 'WebCon.SAP.CustomActions.NaglowekOT+Nagl_OT

How should I implement Items List in my solution that I could be able to return data in workflow?
Please help!!! :)

Greetings Kate.

MVP

Hi Kate,

I've done something similar, the external system was a Xml file which contents has been "copied" to an item list.
Here you can find a "documentation" as well as a link to the source code
https://daniels-notes.de/posts/2021/custom-action-xml-to-item-list

https://daniels-notes.de/posts/2021/custom-action-xml-to-item-list#download

I hope this helps.

Best regards,
Daniel