You are viewing limited content. For full access, please sign in.

Question

Question

Custom Workflow Activity - Object not passing from designer to runtime.

asked on October 4, 2021

I have a custom workflow activity that I created that has an object as a parameter.
The object has a property that is a list of another object.

In the designer, I am able to set all the required fields of the sub-objects and they save and retrieve properly.

The problem happens when the workflow runs.
The base object appears to exist, but the list of child objects is null.

When I reopen the workflow in designer the data is in the designer.

I have a second property that is just a list of objects and that works fine.

 

In the profile activity file, they are defined as

        public List<MyDocument> Documents { get; set; }

        public MyRecipients Recipients { get; set; }

 

in the proxy, they are defined as

        /// <summary>The backing field for the Documents property.</summary>

        private List<MyDocument> documents = null;



        /// <summary>The backing field for the Recipients property.</summary>

        private MyRecipients recipients = null;

 

The MyDocuments class is just a basic object with basic properties.   

 public class MyDocument

    {

        public int ID { get; set; }

        public string Name { get; set; }

        public string MimeType { get; set; }

        public string DocuentId { get; set; }

        public Byte[] Bytes { get; set; }

    }

The MyRecipients class has multiple lists of an object MyRecipient separated by type of recipient.   

public class MyRecipients

    {

        public List<MyRecipient> PrimaryRecipients { get; set; }

        public List<MyRecipient> SecondaryRecipients { get; set; }

    }



    public class MyRecipient

    {

        public int ID { get; set; }

        public string Name { get; set; }

        public string email { get; set; }

    }

 

0 0

Replies

replied on October 4, 2021

Justin,

I haven't worked through all of your provided examples but it would appear to me that in your proxy code you need to actually instantiate the properties with a 'new' operator instead of setting them to null.  Something like this;

private List<MyDocuments> Documents = new List<Documents>();
private Recipients MyRecipients = new Recipients();

 

0 0
replied on October 4, 2021 Show version history

I thought it was fixed but I forgot I added a try/catch, its still not working.
Same issue still.

0 0
replied on October 5, 2021

Justin,

Quick feedback to make sure your proxy instantiation code is correct.  I see a typo in my example to you above.  The proxy instantiation code should be something like;

private List<MyDocuments> Documents = new List<MyDocuments>();
private Recipients MyRecipients = new Recipients();

The other thought is did you address all of the ToDo items when you generated the proxy code with the Activity Proxy Generator?  Particularly the ToDo item  to add copying support for your classes?  

 

 

0 0
replied on October 8, 2021

I was able to resolve this, I had accidentally mixed up my models and my view models. the full model has additional backing fields that were not serializable and that was causing issues.
Once I saw that and fixed it everything is working as expected.

1 0
replied on October 14, 2021

@████████    @████████

I have a similar task to create a custom workflow activity to deliver documents to a group recipients. In the design I need create dropdown list where the values from Database query -- in LF sample code the "ENUM" type could be directly convert to a dropdown via proxy generator tool. However a List<string> or List<object> won't. I am wondering if you can share what you have done in this case to convert list of objects to dropdown? Do I have to use custom control?  Thank you.

0 0
replied on October 14, 2021

Luke,

Almost all of the Qfiche Toolkit custom workflow activities that we have developed use custom user controls for the properties panel UI.  The dropdowns range from simple string lists to lists of complex objects with a display member and value properties set by code.

0 0
replied on October 15, 2021

Thank you Cliff for sharing the thought.

I have another question if you can help:

I am following LF sample (GetTagComments) that use a Dialog to collect information. Since I need build some variables out of existing tokens, I took your advice (in another thread) and use LF own "Laserfiche.Custom.Activities.UI.TextboxWithTokens" control as the text input. However when click the "token edit" it doesn't show any previous activity/tokens, click "token dialog" with nothing showup.

Do you know in this case what should I do to bring in all those activity/tokens?

 

thank you.

 

 

 

0 0
replied on October 15, 2021

Luke,

I believe you are referring to this Answers post?  If so you will see some code in that post that includes an override of the RefreshContext method of the custom user control.  The code in that section is setting the 'context' for the token control which will allow it to see the actual tokens from the workflow.

If you are opening up a new dialog window from your custom user control, instead of just adding the token controls to the custom user control, you will need to pass the custom user control context property to the new dialog window in order to be able to reference it to set the context of token control  in the dialog window.

 

1 0
replied on October 15, 2021

Great! For some reason I didn't find the post but remember you mentioned how to use token edit control to build your own control in another thread.  

I'll take a try with your code sample. Thanks. 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.