Search code examples
c#.net-coreelsa-workflows

How to set Context Id?


I am new with Elsa workflow and I am trying to set Context ID from the designer by the id I get from HTTP Endpoint I created but I do not the syntax that I should use. I tried the JS syntax but it return an error for me.

context.ContextId = WorkflowContext.Id;

Solution

  • First of all, you have to understand how elsa loading context work.

    when you enter the type of your workflow context it automatically make loading for your workflow Context with null value in context Id.

    so you can not access your Workflow Context so what should you do?

    you have first to access your HTTP Endpoint body to get your the information that you want.

    using JS syntax

    input.Body.Id
    

    enter image description here

    enter image description here

    then you have to reload your workflow context in the next activity

    enter image description here enter image description here