1,642 questions
I am getting invalid error from purview workflow apacheatlas code
Cayir Aydar, Aysegul
0
Reputation points
I am getting the error from my python code. But iI got this workflow from Microsoft document. How can I regulate this error?
Failed to send JSON message: (Workflow.WorkflowDefinitionError.WorkflowDefinitionValidationErrors) Error(s) found in the workflow:
WorkflowDefinitionError.WorkflowDefinitionValidationError: In action Send email notification: The expression @{triggerBody()['request']['term']['name']} is invalid.
WorkflowDefinitionError.WorkflowDefinitionValidationError: In action Send email notification: The expression @{triggerBody()['request']['requestor']} is invalid.
WorkflowDefinitionError.WorkflowDefinitionValidationError: In action Send reject email notification: The expression @{triggerBody()['request']['term']['name']} is invalid.
WorkflowDefinitionError.WorkflowDefinitionValidationError: In action Send reject email notification: The expression @{triggerBody()['request']['requestor']} is invalid.
Code: Workflow.WorkflowDefinitionError.WorkflowDefinitionValidationErrors
from azure.purview.workflow import PurviewWorkflowClient
from dotenv import load_dotenv
from azure.core.exceptions import HttpResponseError
import os
from azure.identity import ClientSecretCredential
config = load_dotenv(".env")
endpoint =os.getenv("endpoint")
tenant_id = os.getenv("tenant_id")
client_id = os.getenv("client_id")
client_secret = os.getenv("client_secret")
try:
workflow_id = str(uuid.uuid4())
workflow = { "name": "Create glossary term workflow", "description": "", "triggers": [ { "type": "when_term_creation_is_requested", "underGlossaryHierarchy": "/glossaries/d998388b-9dce-438b-9042-d122a1ed1e66" } ], "isEnabled": True, "actionDag": { "actions": { "Start and wait for an approval": { "type": "Approval", "inputs": { "parameters": { "approvalType": "PendingOnAll", "title": "Approval Request for Create Glossary Term", "assignedTo": [ "0e802fbf-5974-4ccd-a235-315068feba09" ] } }, "runAfter": {} }, "Condition": { "type": "If", "expression": { "and": [ { "equals": [ "@outputs('Start and wait for an approval')['body/outcome']", "Approved" ] } ] }, "actions": { "Create glossary term": { "type": "CreateTerm", "runAfter": {} }, "Send email notification": { "type": "EmailNotification", "inputs": { "parameters": { "emailSubject": "Glossary Term Create - APPROVED", "emailMessage": "Your request for Glossary Term @{triggerBody()['request']['term']['name']} is approved.", "emailRecipients": [ "@{triggerBody()['request']['requestor']}" ] } }, "runAfter": { "Create glossary term": [ "Succeeded" ] } } }, "else": { "actions": { "Send reject email notification": { "type": "EmailNotification", "inputs": { "parameters": { "emailSubject": "Glossary Term Create - REJECTED", "emailMessage": "Your request for Glossary Term @{triggerBody()['request']['term']['name']} is rejected.", "emailRecipients": [ "@{triggerBody()['request']['requestor']}" ] } }, "runAfter": {} } } }, "runAfter": { "Start and wait for an approval": [ "Succeeded" ] } } } } }
result = client.create_or_replace_workflow(workflow_id=workflow_id, workflow_create_or_update_command=workflow)
print(result)
except HttpResponseError as e:
print(f"Failed to send JSON message: {e}")
Microsoft Security Microsoft Purview
Sign in to answer