There is currently a limitation when using coded workflows and coded source files in a project template.
When the template is opened, the references to these break.
For coded workflows, the namespace doesn’t get updated to make the new project name, which then causes an error where it cant find the inherited codedworkflow class and the namespace needs to be manually updated.
Coded source files are trickier, they also don’t get an updated namespace, which isn’t a big deal, but the problem occurs because when they are compiled into a .dll they are given a different assembly name in the new project based on the template. This breaks all the references to any classes made in the coded source file that are used in other workflows and causes the data types to return as ‘Unknown type’ and means you need to fix the bad references.
@Raluca_Laic tagging you to get it to the right team.
Is there any update on this? We have a base template with several .cs workflows for all our new automations so this limitation has a significant impact on our setup. Currently our only workaround is running a post-initialization .ps1 script to rename all namespaces. It gets the job done but a native fix would be highly appreciated.
The coded workflow base class that is inherited by yours coded workflow is dynamically created. One of the reasons for this is so you can invoke workflows using strongly typed classes based on the workflows in your project.
However. You can actually have it inherit the base class from another project, or to be more specific, a library.
If you have a library as a dependency in your template, that has a coded workflow, you can use the namespace from that library to direct the template coded workflow inheritance to the library rather than to the generated class, which gets a messed up namespace in templates.
Now, there are of course downsides and this is quite hacky, most notably, that you have to use the generic method to invoke other workflows etc.
Depending on your use case though, it can be a simple, albeit hacky, fix.
hi @jan.mastalski , what version are you currently using? Speaking to engineering, this should have been addressed in recent versions so want to check if this is still happening.