Javascript Issue in OSB
I have written JS block in OSB: process.status = (process.input.Emp.Status ? "A":"I") — if the input consists of this value assign A else assign I.
The problem here is if I have a hierarchy of Emp→Status it works fine, but if the hierarchy is not there it gives me error: OSB JavaScript action failed: TypeError: Cannot read property "Status" from undefined (<OSB JavaScript expression>#1)
I also gave optional chaining operator (?.
) — but this gives syntax error. Can someone please assist. How can I assign default value if the tag does not appear.