GithubHelp home page GithubHelp logo

elsa-workflows / elsa-guides Goto Github PK

View Code? Open in Web Editor NEW
93.0 6.0 82.0 1.65 MB

A collection of example projects referred to by the Elsa Workflow Guides

License: BSD 3-Clause "New" or "Revised" License

C# 58.10% HTML 28.86% CSS 12.58% JavaScript 0.46%

elsa-guides's Introduction

elsa-guides's People

Contributors

sfmskywalker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

elsa-guides's Issues

ASP.NET Core + Elsa 2.3 - How to create a backend AppService for GetAll workflows

Hi Sipke Schoorstra,

I'm using Elsa 2.3 and all is running fine (dashboard, PostgreSQL), but need to create an AppService to implement a method like:

public async Task<Workflow> GetAllAsync(CancellationToken cancellationToken = default) {
    return await QueryToReturnWorkflowsList;
}

I don't know how to implement the method "QueryToReturnWorkflowsList".
Can help me?
Thanks!

Elsa.Guides.DocumentApproval.WebApp Error

hi,
when i run the Elsa.Guides.DocumentApproval.WebApp project ,i got below error,is there something wrong?

UnparsableValueException: The value string does not match the required number from the format string "D". Value being parsed: '^PT01S'. (^ indicates error position.)

DocumentManagement project

Hello, Thanks to anyone who offers help
I downloaded the "DocumentManagement project" and installed it on my computer, I modified the database used to be SQLServer and downloaded all the necessary blocks to work in the new environment.
rebuild without any error until end give me this Message:
System.ArgumentException
HResult=0x80070057
Message=An item with the same key has already been added. Key: Transient
The following figure is a screenshot:
elsaWf-error
https://ibb.co/KzS0nLq
unfortunately the build did not work, it gives the message and then stops
Is there a solution to this problem? thanks for help me

Dynamically update recurring tasks

Good morning,

I noticed there is a nice feature that allows you to run recurring tasks via Timer or Cron activity. I am wondering is there a chance to dynamically modify the recurring flow?

We are building workflows and would like to send recurring notifications. There are some cases when we need to change the conditions:

  • Workflow expired, canceled, or completed (no needs to send anymore);
  • Interval modified via our settings (need to update Timer or Cron interval);

Can we configure ELSA in the described way and are there any guidelines we could take a look at?

How to Use Elsa with SQL Server and Dapper

Could you please make a guide for using SQL Server with Dapper or even ADO.NET. I do not use Entity Framework. Also, how should I setup my SQL Server database to save and read data for Elsa?

I've tried using this code in the Startup.cs file of my Razor Pages Application with no luck:
services.AddElsa(elsa => elsa.AddYesSqlStores(config => config.UseSqlServer(Configuration.GetConnectionString("ApiWorkflowGateway"))));

Document approval workflow missing HttpRequestEvent

Hello @sfmskywalker

I am struggling to find HttpRequestEvent. I think you have updated it to ReceiveHttpRequest but if use ReceiveHttpRequest It returns empty Document variable with the following error

Elsa.Expressions.WorkflowExpressionEvaluator: Error: Error while evaluating JavaScript expression "Document.Author.Email". Message: Document is null

TypeError: Document is null
Elsa.Services.ActivityInvoker: Error: Error while invoking activity activity-3 of workflow 521455e00da3410da2e167d486855c33

I also tried Dashboard version document approval workflow but it has same issue. It uses HttpRequestEvent

I would appreciate your help

Running the Dashboard applications result in a blank page

Hi,

If I run both the Dashboard and DashboardAndServer projects all I get is a blank screen. I'm using dotnet run. Is there something I"m missing? I'm trying to run this on Ubuntu, not sure if this could be an issue,

image

Regards,
Laredo.

Replacing a workflow

I am currently using source code for the Document approval workflow. Is it possible to replace/add one more workflow (lets say signaling workflow) just by replacing the JSON file in the source code? I tried this and was not able to see any changes. If it is possible, can someone please list the steps?

Updating the post...

DocumentManagement UpdateBlockchain issue

When execute UpdateBlockchain Activity on Identify Verification Workflow, an error occurred,
image
The FileStream cannot work with Newtonsoft.Json in the background task.
The UpdateBlockchain activity was as follow:
image

This Guide Project Errors on EF Migrations when run with .NET5

Attempting to run through the guide to get the Dashboard up and running fails when undertaking the EF Migration step:

dotnet ef database update --context SqliteContext
Build started...
Build succeeded.
Applying migration '20201029094740_Create'.
System.MissingMethodException: Method not found: 'Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder`1<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.ColumnsBuilder.Column(System.String, System.Nullable`1<Boolean>, System.Nullable`1<Int32>, Boolean, System.String, Boolean, System.Object, System.String, System.String, System.Nullable`1<Boolean>, 
System.String)'.
   at Elsa.Persistence.EntityFrameworkCore.Migrations.Sqlite.Create.<>c.<Up>b__0_0(ColumnsBuilder table)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationBuilder.CreateTable[TColumns](String name, Func`2 columns, String schema, Action`1 constraints, String comment)
   at Elsa.Persistence.EntityFrameworkCore.Migrations.Sqlite.Create.Up(MigrationBuilder migrationBuilder)
   at Microsoft.EntityFrameworkCore.Migrations.Migration.BuildOperations(Action`1 buildAction)
   at Microsoft.EntityFrameworkCore.Migrations.Migration.get_UpOperations()
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.GenerateUpSql(Migration migration, MigrationsSqlGenerationOptions options)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.<>c__DisplayClass16_2.<GetMigrationCommandLists>b__2()
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String connectionString, String contextType)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String connectionString, String contextType)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Method not found: 'Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder`1<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.ColumnsBuilder.Column(System.String, System.Nullable`1<Boolean>, System.Nullable`1<Int32>, Boolean, System.String, Boolean, System.Object, System.String, System.String, System.Nullable`1<Boolean>, System.String)'.

Breaking changes from version 2.4.0-preview.493 to 2.5.0

Hello.
Current elsa-guides uses version 2.4.0-preview.493 of Elsa libraries. When I try to upgrade it to 2.5.0 I got an error on DocumentManagement.Workflows.Handlers.StartDocumentWorkflows, line 31. Current version contains:

// Get all workflow blueprints tagged with the received document type ID.
            var workflowBlueprints = await _workflowRegistry.FindManyAsync(x => x.IsPublished && x.Tag == documentTypeId, cancellationToken).ToList();

After the upgrade, I got the following compiler error:
"Error CS1061 'IWorkflowRegistry' does not contain a definition for 'FindManyAsync' and no accessible extension method 'FindManyAsync' accepting a first argument of type 'IWorkflowRegistry' could be found (are you missing a using directive or an assembly reference?)"

What could be a good replacement for method IWorkflowRegistry.FindManyAsync in version 2.5.0?

Kind regards.

Branching with If then else

Please provide sample for using 'if' branch activity from code , using previous activity result in condition

The solution is unable to build!

This solution is unable to build after I downloading the full code and even fix the path references, some issues about unknown classes such as "CollectWorkflowsContext" are obvious out of my abilitity to fix them, any ideas? thanks!

Document Approval Workflow workflow ends with HTTP Response activity, but there was no HTTP Request.

Hello!

Please help to understand how it internally works with HTTP request/response activities:

In this workflow example the workflow is triggered by HTTP request:
https://elsa-workflows.github.io/elsa-core/docs/next/guides/guides-document-approval

image

As i understand when user posted request he wont receive response until steps SetVariable and SendEmail finish gracefully.

  1. What will happen with http request if SendEmail fails, because lets say smtp server timed out for 10 min?
    Will this activity step will be restarted or workflow will be failed? What will happen with http response which i guess user still waits until http request times out?

  2. Don't understand the end of workflow which finishes with HTTP response activity. But where was http request?
    Please help understand this =)

Thanks!

src/installation/elsa-studio/ElsaStudioBlazorServer sample does crash at login

When I download the sample and do want to run it, it doesn't work:

First, the Elsa.Api.Client nuget is missing from the sample. I can add this myself, no problem.

Second, no that the project builds and the login page appears, I can input admin and password. But then the blazor ui crashes with a HttpRequestException.

System.Net.Http.HttpRequestException: Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte. (localhost:5001)
 ---> System.Net.Sockets.SocketException (10061): Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte.
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|281_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
   at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter`1.WaitForConnectionAsync(Boolean async, CancellationToken requestCancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Refit.RequestBuilderImplementation.<>c__DisplayClass14_0`2.<<BuildCancellableTaskFuncForMethod>b__0>d.MoveNext() in /_/Refit/RequestBuilderImplementation.cs:line 256
--- End of stack trace from previous location ---
   at Elsa.Studio.Login.Services.DefaultCredentialsValidator.ValidateCredentialsAsync(String username, String password, CancellationToken cancellationToken)
   at Elsa.Studio.Login.Pages.Login.Login.ValidateCredentials(String username, String password)
   at Elsa.Studio.Login.Pages.Login.Login.TryLogin()
   at Elsa.Studio.Components.StudioComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Elsa.Studio.Components.StudioComponentBase.InvokeWithBlazorServiceContext(Func`1 func)
   at Microsoft.AspNetCore.Components.Forms.EditForm.HandleSubmitAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'PdOc5BnTLF9Q39X-OOnbleQxTZiIJasl0hI1wIr6oGk'.

This is probably, because the appsettings.json points to https://localhost:5001/elsa/api as backend while the server runs on "applicationUrl": "https://localhost:53214;http://localhost:53215".

I can also change this to point to the right endpoint

Third, now that appsettings point to the app url, if I try to login again, I get this error:

Refit.ApiException: Response status code does not indicate success: 400 (Bad Request).
   at Refit.RequestBuilderImplementation.<>c__DisplayClass14_0`2.<<BuildCancellableTaskFuncForMethod>b__0>d.MoveNext() in /_/Refit/RequestBuilderImplementation.cs:line 288
--- End of stack trace from previous location ---
   at Elsa.Studio.Login.Services.DefaultCredentialsValidator.ValidateCredentialsAsync(String username, String password, CancellationToken cancellationToken)
   at Elsa.Studio.Login.Pages.Login.Login.ValidateCredentials(String username, String password)
   at Elsa.Studio.Login.Pages.Login.Login.TryLogin()
   at Elsa.Studio.Components.StudioComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Elsa.Studio.Components.StudioComponentBase.InvokeWithBlazorServiceContext(Func`1 func)
   at Microsoft.AspNetCore.Components.Forms.EditForm.HandleSubmitAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'd6-nJm9fFXPt3LK-GaQ0Io24RKX-OsV2eQ8qcVJa0gQ'.

I have also tried to copy the code directly from the docs, but same result.

Dashboard not Working

I'm trying to get this thing up and running, but with no luck.
I'm not sure is it a missing documentation issue or hosting config error.
I have tried both "/" & "/elsa/home" paths with no luck, just a 500 error :(

Elsa - Hello Dashboard - Can't run Elsa Dashboard

Trying the Hello dashboard from https://elsa-workflows.github.io/elsa-core/docs/guides-dashboard
Run EF Migrations - while setting up the EF connection string,
Getting this error - The term "Cache=Shared" is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again

Eliminating this "Cache=Shared" couldn't create the Database instance,
image

use sqlserver with document.management.web project

Hi, thanks to help me
I made minor changes to make the application work with dotnet.cor 6.0 and SQLserver database, as follows:

  • Installing nuget elsa packages which works with sqlserver instead of sqlite
    Modify files that use sqlite with those that use sqlserver
    When building the application, the following error appeared, and I did not know how to correct it. Is there any help?
    elsa-error

Project reference error

I copied this Project and I got so many project ref.errors, Not able to build.
Could you please update solution and project files.

Thanks.
Elsa Guide error

Document Approval Guide - Null value from context.GetInput<HttpRequestModel>()

Following the guide for the Document Approval workflow, and within DocumentApprovalWorkflow.cs, a null value is returned by context.GetInput() on the following line when opening an instance or from the workflow registry :

.SetVariable("Document", context => context.GetInput<HttpRequestModel>()!.Body)

without the Document variable being set, the other references to it also throw an error. I downloaded the project and received the same error.

I'm currently using Visual Studio 2019 version 16.10.0, and have tried with both .NET 5 and 6

Document Approval

[Web Project with .NET6]
[Elsa 2.8.2]

I tried the Document Approval tutorial and the reminder mail is continuously sent even if I click on the Activate or Reject link.

I get the expected behavior by linking the Reminder Mail activity to the Fork (and not the Timer like the guide say) in the Workflow Designer.

image

I am curious to see what is the corresponding C# code.

Can not run the samples

Hi,When I try to run the projects and it doesn't matter which one after a 10 seconds I will get this error

image
I cannot find this setting anywhere inside the solution , I think it is somewhere inside the Elsa library

The Dashboard Guide does not currently work.

Using dotnet core 3.1

The DesignTimeElsaContextFactory type can't be found, I haven't had time to dig into it but I wanted to let you know.

using Elsa.Persistence.EntityFrameworkCore;

namespace WorkFlowHost
{
    public class ElsaContextFactory : DesignTimeElsaContextFactory
    {
    }
}

Also, in the program portion, .AddElsaDashboard(options => options.DiscoverActivities()); does not work.

using Elsa.Activities.Http.Extensions;
using Elsa.Activities.Timers.Extensions;
using Elsa.Dashboard.Extensions;
using Elsa.Persistence.EntityFrameworkCore.Extensions;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace WorkFlowHost
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services
                .AddElsa(elsa => elsa.AddEntityFrameworkStores(options => options.UseSqlite(Configuration.GetConnectionString("Sqlite"))))
                .AddHttpActivities(options => options.Bind(Configuration.GetSection("Elsa:Http")))
                .AddTimerActivities(options => options.Bind(Configuration.GetSection("Elsa:Timers")))
                .AddControllers();

            services.AddElsaDashboard(options => options.DiscoverActivities());
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();
            app
                .UseStaticFiles()
                .UseHttpActivities();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
    }
}

throws:

Error CS1929 'OptionsBuilder' does not contain a definition for 'DiscoverActivities' and the best extension method overload 'ActivityDefinitionListExtensions.DiscoverActivities(ElsaDashboardOptions)' requires a receiver of type 'ElsaDashboardOptions'

Why cron activity cannot be the first activity?

In Cron activity there is a check for the first pass.
And if it is a the first pass elsa doesnt execute the cron activity as planned, what is the reason for this?

I have tried to remove that check, and it works also as the first activity, so what was the intention of adding that check?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.