Home > Forum > Forms > Possibility of using two form types in one workflow to rearrange form fields for one step only

Possibility of using two form types in one workflow to rearrange form fields for one step only
0

MVP

Hi Fabian,

if you only need this in one step, you could simply break the inheritance. This will allow you to create a completely different layout.
I personally hate this option, but there are these cases where you have to fall back to it.
The reason why I hate this: You always have to remember that reapply all changes regarding field order / visibility. Something which is easily forgotten.

Of course you could achieve the same with two form types. As far as I'm aware there's no action for changing the form type but you can create a SDK action:

public class UpdateDocumentType : CustomAction<UpdateDocumentTypeConfig>
{
public override void Run(RunCustomActionParams args)
{
if (!int.TryParse(this.Configuration.FormTypeIdAsString,out int formTypeId))
{
throw new ApplicationException($"Value '{this.Configuration.FormTypeIdAsString}' could not be parsed to integer.");
}
args.Context.CurrentDocument.UpdateDocumentType(formTypeId);
}
}

public class UpdateDocumentTypeConfig : PluginConfiguration
{
[ConfigEditableText(DisplayName = "Form Type")]
public string FormTypeIdAsString { get; set; }

}

Best regards,
Daniel

In reply to: Daniel Krüger (Cosmo Consult)

Hi Fabian,

if you only need this in one step, you could simply break the inheritance. This will allow you to create a completely different layout.
I personally hate this option, but there are these cases where you have to fall back to it.
The reason why I hate this: You always have to remember that reapply all changes regarding field order / visibility. Something which is easily forgotten.

Of course you could achieve the same with two form types. As far as I'm aware there's no action for changing the form type but you can create a SDK action:

public class UpdateDocumentType : CustomAction<UpdateDocumentTypeConfig>
{
public override void Run(RunCustomActionParams args)
{
if (!int.TryParse(this.Configuration.FormTypeIdAsString,out int formTypeId))
{
throw new ApplicationException($"Value '{this.Configuration.FormTypeIdAsString}' could not be parsed to integer.");
}
args.Context.CurrentDocument.UpdateDocumentType(formTypeId);
}
}

public class UpdateDocumentTypeConfig : PluginConfiguration
{
[ConfigEditableText(DisplayName = "Form Type")]
public string FormTypeIdAsString { get; set; }

}

Best regards,
Daniel

Thanks for the answer first and foremost!

I tried it out right now, but I get the error that "PublishPluginsPackage.ps1" is not digitally signed so I cannot publish my extension.

I already tried "Set-ExecutionPolicy unrestricted" on my local machine which sadly did not work

Do you know any way around that or how to fix that?

Thanks in advance

MVP
In reply to: Kuchling, Fabian (DCCS)

Thanks for the answer first and foremost!

I tried it out right now, but I get the error that "PublishPluginsPackage.ps1" is not digitally signed so I cannot publish my extension.

I already tried "Set-ExecutionPolicy unrestricted" on my local machine which sadly did not work

Do you know any way around that or how to fix that?

Thanks in advance

Hi Fabian,


it's strange that the policy wasn't changed. Have you executed PowerShell as an administrator when you set the execution policy? I just noticed that you receive an error, when you don't do it.

I'm not sure whether a restart of Visual Studio would make any difference.

I just stumbled about this question. But it's from a long time ago and I don't believe that you are using Visual Studio in 32bit on a 64 bit machine.
https://stackoverflow.com/questions/6142914/powershell-executionpolicy-is-wrong-when-run-through-visualstudio

Nevertheless, if you only have SDK actions, without React components, you an simply put together the .zip file with the required files yourself.

Here's are two replies how to do this:
https://community.webcon.com/forum/thread/677

Best regards,
Daniel