Need Guidance: Prevent On Close Server Event to get called when there is Error (when voting) and the CM Activity is not Closed?

Hello All,

I'm creating a server-side method that sends an email to the Change Leader. It gets invoked "on close" in association with a Change Management workflow activity. The email should be sent only when the activity is closed, and the workflow progresses to the next activity. However, if the user votes on the activity while there are missing affected files related to the Change Management, an error message is displayed stating "The New Number field is required when Action is set to 'Add'." I want to find a way to prevent the email from being sent when such and similar errors exist.

I tried to use activity.getProperty("state", ""); to check if the state of the activity changes from Active to Closed. However, this property does not update (when the method is invoked) while the mentioned error exists or not.

Currently, I'm thinking of a way to access this error message content from my method and act accordingly. I tried isError() and it gives 0 (no error), getErrorString() and getErrorDetails() return an empty string.

I would appreciate it a lot if someone can help me with it.

Best Regards,

abdu

  • Hi Abdu,

    I am not very familiar with the "on close" events. But you could try an "on Activate" event on the next Workflow state. I always use this variant when validating something before users can proceed. If the Method is aborted, the workflow state will not become active.

    Do you use a custom server Method for the email on purpose? Couldn´t you use the integrated Notification options? 

    Best regards!

    Angela