elsa-workflows / elsa-core

A .NET workflows library
https://v3.elsaworkflows.io/
MIT License
6.4k stars 1.18k forks source link

Add Form Builder to Elsa #2625

Closed pesar368 closed 2 years ago

pesar368 commented 2 years ago

Hi. I Want to Add Form Builder to Elsa . My Idea is Create a part that user can design Form in Designer Dashboard and have Some API for Forms Persistance. and then user fills form and run validations and submit the form and send Signal to Workflow.

1) Form Design create form fields and buttoms and form validations

2) Run Form input data and run validations

3) Submit Form 4) Sending Submited Form Signal to Workflow 5) Recieveing Submited Form Signal on Workflow and Trigger Workflow 6) Workflow Run

Do you think thats possible?

Currently i'm not sure where to start for trying to implement an "Form Builder"... I will try to find out, how, or if this can be done with Elsa.

If you can give me any directions this would be great!

tomy2105 commented 2 years ago

HI, nice idea, although I don't see why you need signal in here. Elsa is capable of receiving http requests and sending responses and that is all that is needed for HTML form based workflow.

One activity, built on top of HTTP Response, that would allow you to easily, visually :), build form that would be sent as http response would definitely be nice.

HTTP Endpoint is already capable of parsing form submissions, you'd only need to enhance new activity over it that would listen to a unique URL.

This way you could have multiple chained forms executed in single workflow.

Hm..... now I see where you are getting at with signal.... :)

Then I'd vote for signal being able to receive data along with the signal like HTTP Endpoint on unique URL (@sfmskywalker would that be possible, or even is possible now? What does POST on Signal URL currently do?)

mohdali commented 2 years ago

I did implement a basic form builder approach using custom activities.

pesar368 commented 2 years ago

Hi Guys. Thanks for Reply. I Need Signal Because my Forms Generate at runtime and hasn't unique URL. So I Handle it by Signal.

Dear @mohdali and @tomy2105 can i see your sample code ?

mohdali commented 2 years ago

You can follow this guide and tweak it to your purpose. https://elsa-workflows.github.io/elsa-core/docs/next/guides/guides-document-approval

I think you need to set the correlation id to something that you can track. That would be the easiest way to manage multiple form instances.

sfmskywalker commented 2 years ago

I would love to have a Forms Builder module for the dashboard. Essentially like what Orchard Core has.

pesar368 commented 2 years ago

@sfmskywalker I try to do it and contribute your repo

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

hirandesai commented 2 years ago

@mohdali - Can you share your sample so that we can take it forward? I am also looking for similar requirement

mohdali commented 2 years ago

@mohdali - Can you share your sample so that we can take it forward? I am also looking for similar requirement

Unfortunately I'm not able to share my sample, however I can try to help answer any queries you have as much as I can.

hirandesai commented 2 years ago

@mohdali - So I am trying to integrate a form builder with the Http Process to see how that can be achieved so that User can build their form but behind the scene, Elsa workflow gets executed.

Also, The approve and reject are done through email... What if I need to do that through UI instead of an email?

mohdali commented 2 years ago

@mohdali - So I am trying to integrate a form builder with the Http Process to see how that can be achieved so that User can build their form but behind the scene, Elsa workflow gets executed.

If you can capture the form content as JSON you can easily send it to HTTP activity as payload. You would be also creating a new instance each time a form is submitted. It is useful to capture a unique id for that form instance and set it as the correlation ID for your workflow instance.

Also, The approve and reject are done through email... What if I need to do that through UI instead of an email?

Depending on your setup, if Elsa and form application are running in the same .NET application you can easily trigger a signal activity. By setting the correlation ID to your form instance you can easily track the correct instance in your workflow as well.

If your form application and workflow are running separately then you may need to setup your own message passing using rebus or something. Or probably you can still trigger the Signal using the web API (haven't checked that part myself).

You can always build your custom activities to customize the workflow further. But it is doable with HTTP and Signal activities as well.