Describe the problem/error/question
I want to remove the assignee field or value when there is undefined
in the following node :
Currently I’m getting
NodeOperationError: ERROR: Assignee parameter's value is invalid. Please enter a valid ID.
I want to remove the assignee field or value when there is undefined
in the following node :
Currently I’m getting
NodeOperationError: ERROR: Assignee parameter's value is invalid. Please enter a valid ID.
Hey @QuantumSheep,
Welcome to the community
Best option there would be 2 nodes one with assignee and one without then use an if node to work out which one needs to be used. It could be that the jira api allows a value to be set with something like undefined
or null
but I suspect you have tried that already so I would take the 2 node approach.
Hey, thanks for you answer!
Yes I’ve tried undefined
and null
without success I guess the only presence of
assignee
makes the Jira API to check validity for this field.
I implemented a fix for this issue.
The PR looks ok and if I am reading it right if a non required field has no value set it won’t send it, In theory that is good but I think that might actually break some functionality. As it is a core change though it will need to go to a different team to review so for now the best solution is still going to be using 2 nodes
My thought on this which I was writing up as a feature request was to have a property for fields that can be set to only be sent if not empty or if an expression validates this would open a lot more doors for other things.
We could add an optional
field instead of using required === false
to mitigate any breaking changes.
There is a hacky workaround for this. Using the custom fields option you can enter any standard field name like summary
, assignee
, reporter
. Then just use an expression {{ null }}
for the value.
I get the following error:
ERROR: Bad request - please check your parameters
400 - {"errorMessages":[],"errors":{"assignee":"data was not an object"}}
Can you post a screenshot of your config? Or the workflow JSON
EDIT: simplify the expressions
Took me a while to circle back to this one.
That’s close, but won’t provide the correct object if you’re assigning and not unassigning.
See this workflow as an example, it will swap the assignee
and reporter
whether they’re null or assigned.
The key is creating the object:
assignee customer field: {{ { name: $json.Reporter?.name ?? null } }}
reporter customer field: {{ { name: $json.Assignee?.name ?? null } }}