Comments (3)
Based on the context provided, it seems that you are encountering an issue where the output of a workflow used as an activity within another workflow is being treated as a string instead of an object. This issue is likely due to the way the output is being serialized or deserialized when passed between workflows.
To address this issue, you can use the workaround you mentioned, which involves setting the output of the activity to JSON and then using a SetVariable
activity to parse the JSON string back into an object. Here's a step-by-step guide on how to implement the workaround:
- Ensure that the first workflow has an output defined as an object and that it is set to be usable as an activity.
- In the first workflow, create dummy data as JSON and use
JSON.parse()
to ensure the output is an object. - In the second workflow, add the first workflow as an activity.
- Set the output of this activity to a variable, but instead of setting it as an object, set it as JSON.
- After the activity, add a
SetVariable
activity. - Configure the
SetVariable
activity to set a new variable of type object with the parsed output from the activity using the expressionJSON.parse(getMyOutputFromMyActivity());
. - Use the new object variable as needed in the rest of your workflow.
By parsing the JSON string into an object, you should be able to access its properties and use it as an object within your second workflow.
Please note that this is a workaround, and ideally, the system should handle the serialization and deserialization of objects correctly without the need for manual parsing. It might be worth reporting this issue to the Elsa Workflow GitHub repository or checking if there is an existing issue or update that addresses this behavior.
from elsa-core.
I tried to create a Workflow where I isolate the issue.
In that workflow, everything behaves as expected, the variable is of type object.
So the issue is not consistent or not where I assumed to be.
I added the workflow where the bug happens, which seems to do exactly the same thing as the example.
Is it possible that the variable somehow remembers that it once got a string, and then always converts its value to string, even when set to type object?
from elsa-core.
Hi @Nekrosis1 , thank you for reporting this issue. When trying to reproduce the issue, I imported your workflows, but they contain references to custom activities:
Is there any chance you can reproduce the behavior without using custom activities?
from elsa-core.
Related Issues (20)
- Workflow Instances GET Endpoint - Broken Statuses and SubStatuses Filters
- unable to use simple configuration of HttpRequest with content-type application/x-www-form-urlencoded HOT 1
- Add dry run option to alterations HOT 1
- workflowRunner.RunAsync is not retuning Result when trying to resume workflow. HOT 2
- What should we pass as a first parameter HOT 2
- Optimize import of workflow definitions HOT 2
- Http Flow HOT 1
- How to invoke HTTP Endpoint in the middle of an executing workflow? HOT 1
- Hello, how can I reset "Completed" in Activity Status to "Running"?
- How to notify the changed status of activity to the business system ? HOT 1
- how to pass input to workflow and activity while executing the workflow HOT 5
- State Machine Activity
- How to sent custom event to webhook endpoint? HOT 1
- How to make a workflow instance whith not runing? HOT 1
- How to get all status from "Activity/WorkflowExecutionMiddleware"? HOT 2
- Resume bookmark with payload HOT 3
- How to subscribing events or notifications that Elsa might publish when activities change their status? HOT 1
- Alterations API: Get planId returns a 404 HOT 2
- Alterations API: Submitted planned is stuck on status: Dispatching
- Cann't find System.ComponentModel.Annotations(>= 6.0.0-preview.4.21253.7) in nuget HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elsa-core.