Lists and Display rules inside custom actions
8min
after creating the class library ( net 6) project and adding the procesio nuget package you will need to complete the two mandatory requirements in order to implement your classes to become proper custom action inherit the iaction interface this is mandatory because procesio needs the execute method in order to run your action within a flow this is where you will add the logic of whatever behavior you need the action to have use proper attributes for your properties to define what type and use they have within your new action these attributes are necessary for procesio to create the action template, which is like a contract used for the ui to dynamically interpret and display any type of provided action correctly within the platform it is important to note that once the custom action is added by uploading your nuget file it can be used for any of your processes and that it can not be updated, for this you will need to rebuild the nuget package with a different version number, then create it again in the process designer example of full properties implementation \[fedecorator(label = "fe input property", type = fecomponenttype select, tab = "input tab", options = "myoptionslist")] \[bedecorator(ioproperty = direction input)] \[validator(isrequired = false)] public int myinput { get; set; } \[fedecorator(label = "fe output property", type = fecomponenttype number, tab = "output tab", defaultvalue = "2")] \[bedecorator(ioproperty = direction output)] \[validator(isrequired = true, expects = expectedtype number)] public int myoutput { get; set; } the accepted types for a property are int string boolean double datetime we do not accept at this point user defined types or nullable types the value of a property in the designer will be the defaultvalue from the fedecorator if that property is not required via the validator decorator and defaultvalue is not defined either, then we will use the default value of the corresponding data type from c# (0 for int and double, false for boolean, etc ) the same applies if the default value is deleted by the user and no other value is specified using lists to use a list inside a custom action, one would have to define an ienumerable property of the required type to this end, there are several cases where this applies 1\ list of primitive data type ienumerable\<int> numericlist {get; set;} the list usage is quite straightforward in this case 2\ list of custom data type ienumerable\<jobject> mycustomlist {get;set;} this list is a classic ienumerable of objects, but their content is dynamic, receiving a json value as input the action developer must know the json structure to work with 3\ list of files ienumerable\<filemodel> filelist {get; set;} this is a list of files, where each file is sent as a data stream, accessible through the action core filemodel type the filemodel type has only two properties name and file the name property holds the file name, and the file property holds the file stream which can be used to retrieve the file content example in using the file stream when iterating through the file list foreach(var file in filelist) { = file name; // this is the file name if required = file file; // this is the file stream which can be used to retrieve file content // example of file stream use using system io stream filestream = file file; console writeline($"file stream has length of {filestream length}"); } display rules to control the order in which the frontend components will be displayed, we use the orderid and rowid properties the orderid applies to tab components and it controls the order in which tabs are displayed the rowid controls the order of the components inside a parent (a tab, modal, or side panel) all components inside a parent component should have a unique rowid, otherwise, the display order will be inconsistent multiple components can have the same rowid as long as they belong to different parent components an example of usage is //use orderid to specify the order in which tabs should be displayed \[fetabdecorator(tabname = "details", orderid = 1)] //use rowid to specify the order in which components inside a parent //should be displayed \[fedecorator(label = "value to increment", type = fecomponenttype number, tab = "details", rowid = 1)] another use case for a custom action would be to order ascending or descending a list of numbers that you input in your flow besides the examples provided in this document, you can also follow the given example of custom actions provided by the procesio core project custom template action