I have a workflow which either returns immediately after execution or waits for few days depending on the input args. If it returns immediately I want to wait until execution and if it might get delayed I want to say to the user that it will take time. Is it possible to do this in temporal?
One way you could consider is updating customer from activity (push, for example webhook) and not wait for result.
Another way could be to have your workflow evaluate input and then start async child workflow with “abandoned” parent close policy, see impl here that would do the “long” business logic. The parent workflow can then return response immediately and the child workflow could continue.
Third way could be to start your execution, store the response in workflow state and have client query this execution to get this result and present it to user.
There is an suggested UpdateWithStart feature that I think will be very useful for this type of use cases as well.