elsa-workflows / elsa-workflows/elsa-core

Elsa.WriteLine expression and memory reference

Open
#5,302 1 comment 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
7.9k
Forks
1.5k
Avg merge
15h 22m
Merged PRs (30d)
114

Description

### Discussed in https://github.com/elsa-workflows/elsa-core/discussions/5301

This seems to be a bug , I am using Elsa 3.1.3 libraries and Elsa Studio 3.2 . Attached JSON file when loaded through code and run memory reference is not handled correctly.
[issue-test.json](https://github.com/elsa-workflows/elsa-core/files/15151941/issue-test.json)

Originally posted by **mremadevi** April 29, 2024
This is in reference to discussion #5300

Understand that memory reference is an internal mechanism used Elsa to track activity inputs and outputs and defining workflow through designer handles the reference internally .

If the workflow is defined thorough visual designer and saved as JSON file . Application loads the JSON file and executes the workflow through code , how is references handled ? In example below WriteLine uses output of previous activity set in variable as input
using expressions . When JSON is exported , there is no memory reference for input 'text'. It only has expression. This will fail when JSON workflow file is loaded and executed from code with memory reference doesn`t exist error. Manually setting a unique memory reference id is also not working .

What is the right way to use previous activity output when loading workflows from JSON file and running workflow from code.

{
"text": {
"typeName": "String",
"expression": {
"type": "JavaScript",
"value": "Nice to meet you, ${getName()}!"
}
},
"id": "WriteLine2",
"type": "Elsa.WriteLine"
}

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the attached issue-test.json, loading it through code, and running the Elsa.WriteLine workflow. Read the discussion and inspect how memory references are handled for the WriteLine text expression. Done means the workflow can use the previous activity output without a missing memory reference error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, javascript
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.