Skip to content

Commit

Permalink
chore: Pass execution env and item
Browse files Browse the repository at this point in the history
  • Loading branch information
ramedina86 committed Sep 30, 2024
1 parent 3c00960 commit e4495c1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/writer/workflows_blocks/foreach.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ def register(cls, type: str):
},
"items": {
"name": "Items",
"desc": "The item value will be passed in the execution context and will be available via @{item}.",
"desc": "The item value will be passed in the execution environment and will be available via @{item}.",
"default": "{}",
"type": "Object",
"control": "Textarea"
},
"context": {
"name": "Context",
"desc": "You can add other values to the execution context.",
"executionEnv": {
"name": "Execution environment",
"desc": "You can add other values to the execution environment.",
"default": "{}",
"type": "Object",
"control": "Textarea"
Expand All @@ -54,11 +54,11 @@ def register(cls, type: str):
def run(self):
workflow_key = self._get_field("workflowKey")
items = self._get_field("items")
context = self._get_field("context")
base_execution_env = self._get_field("executionEnv")

try:
for item in items:
writer.workflows.run_workflow_by_key(self.session, workflow_key)
writer.workflows.run_workflow_by_key(self.session, workflow_key, base_execution_env | { "item": item })
self.outcome = "success"
except Exception:
self.result = "HTTP call failed."
Expand Down

0 comments on commit e4495c1

Please sign in to comment.