Display alert from a custom workflow activity - dynamics-crm

Is there a way to show an alert(Message box) from a C#-based custom workflow activity? I'm calling the custom workflow activity from a workflow process

I'm guessing that your workflow is synchronous, otherwise when would the alert appear and to whom? Doesn't really matter though, sync or async, showing an alert from a custom wf assembly is not possible.

If you want to show a message to a user (presumably an error message?) then use a syncronous plugin.
If the plugin throws an exception then the user will see this (and the transaction will roll back).

Related

Does a slack bot listening for specific message events get invoked every time a new message is posted? Has anyone encountered problems with this?

Just curious to know how others handle this from a security perspective. In a workaround related to Microsoft Power Automate, I'm using events and bolt-python to listen for a key word that will trigger an action to my bot endpoint. The issue is, as I'm building and testing this, every message posted is triggering an unhandled request and invoking my bot.of course the logic I want will execute fine when the key word is triggered but the amount of unnecessary triggers with the messages is concerning.

Dynamics Custom Action Process Session

I am working with a test action that when activated and called via javascript will fire an email message. I used an action because I wanted to pass in some values to be used in the process. In a traditional workflow I could see the history of each time the workflow was fired.
Is there a way to see all of the times my custom action fired?
Traditional workflow are Asynchronous. What you are seeing as Process Sessions are actually Async Execution logs. Those are not available/applicable for Sync jobs like Realtime workflows or Actions. Maybe you can keep the failure logs in Action.
Unfortunately you have to assume from the Emails that sent out is Action execution time.

Display a pop-up window with status message of a succeeded workflow

I've a form which runs a real-time workflow. When the workflow succeeds, I need to display the status message of the workflow in a pop-up window or an alert message box.
Any ideas on how I can achieve this?
You can only show messages to the user from within a synchronous workflow if you cancel the workflow:
When you set the status to canceled, you prevent the operation. An
error message containing the text from the stop action status message
will be displayed to the user with the heading Business Process Error.
There is no way of showing an informational message from a succeeded workflow.
As a workaround, you could have the workflow write your informational message to a field on the entity. You could then write JavaScript that checks if the message-field contains data, show a form notification (or an alert if you insist) to the user, and subsequently clear the message-field.

How do you throw an exception from a custom workflow activity in CRM 2011?

How do you throw an exception from a custom workflow activity in CRM 2011 so that the user sees it? From a plugin I can throw InvalidPluginExecutionException, but that does not throw an exception (to the user) from a custom workflow activity.
Because workflow processes run asynchronously, you cannot really "present" an error to a user immediately as it occurs. The exception details are logged though whenever an exception is thrown; if you look under Settings -> System Jobs (or the Processes tab on the entity record the workflow was kicked off from) a workflow job record with a status of Failed will be present. This record will show you where in the workflow the exception occurred along with the details of the exception.
One way I can think of off the top of my head to notify the user of an exception would be to catch the errors and kick off an email (if it's really necessary).
I have not played with Dialogs yet so I'm not sure how they handle exceptions in custom assemblies, but that might be a route to check.

How do I hook another applications events?

I'd like to hook the event that is triggered when an application is trying to notify you of something (when its icon background turns orange and starts flashing) so that I can create my own custom notifications (like getting a text message or email)
For example I'd like to have an event triggered when I receive an instant message on my computer that will send a message to my phone so I can respond appropriately.
How would I go about doing this?
Preferably I'd like something that could hook any notification event (then do the filtering inside the application, and something that works on windows XP and up)
Thanks
Duplicate of How can I determine which taskbar application/windows are requesting user attention ? Anyway, use RegisterShellHookWindow and catch HSHELL_FLASH

Resources