SharePoint Remote Event Receivers Receivers enable communication between SharePoint and K2, such as starting a workflow when you add an item to a list. The endpoints are configured for you when you integrate a SharePoint list or library with K2 for SharePoint and configure the workflow to start with a SharePoint event.

Scenario

You use a SharePoint Document Library to store employee contract documents. You want to start a K2 workflow each time a new contract is added to the library. In this scenario, the trigger that starts the workflow is the "An item was added" SharePoint event.

You may run into cases where you notice the workflow does not start. You can troubleshoot this by opening the Window Event Viewer and looking for the message – “A SharePoint Remote Event Receiver tried to start the workflow <workflowname> that does not exist on the server”.

This can happen when:

  • You have not deployed the workflow. You integrated your list or library with K2 for SharePoint, configured the workflow, but did not deploy it
  • The integrated workflow was deleted. You or a K2 administrator used K2 Management to delete the workflow

It is important to understand the difference between a deployed workflow and a designed workflow. While you’re building your workflow it is in design mode. In this mode, your workflow changes are saved but new instances of it cannot be started unless you deploy it.

Use the following two scenarios of why the “A SharePoint Remote Event Receiver tried to start the workflow <workflowname> that does not exist on the server” information message shows in the Windows Event Log and how to resolve or avoid it.

Scenario 1: Undeployed Workflow

Issue

For this scenario, you create a list, but the same principle applies to a library. You integrate the list with K2 for SharePoint and select to generate a workflow that starts when an item is added to the list (but it can be any list or library event). The workflow opens in the Workflow Designer where you start configuring it by adding steps etc. You DO NOT deploy the workflow.

While you’re configuring the workflow, someone adds an item to the list. SharePoint sends the event to K2 but the workflow does not start because you have not yet deployed the workflow.

The following information message shows in Windows Event Viewer:

“A SharePoint Remote Event Receiver tried to start the workflow <workflowname> that does not exist on the server”.

Image

Image

Prior to the K2 Cloud Update 6 / K2 Five 5.2 release, you see four error messages in the Windows Event Viewer.

Workaround

Until you deploy the workflow, this information message is logged in the Event Viewer every time an event starts from SharePoint. In this scenario, when an item is added to the list. This message is for information only and can be ignored. It is expected that the time to design a workflow is relatively short compared to how long your solution is expected to be used. If the design of the workflow is expected to take a long time before you deploy it, it is recommended that you NOT configure the Remote Event Receiver in the Start event until closer to deployment.

The reason why this message is marked as information only is that nothing happens other than SharePoint sending K2 events. K2 cannot do anything with those events, and there is no effect on the list items added. If you want to stop these messages from occurring, re-run your workflow Start event and remove the remote events until you’re ready to deploy the workflow. At that point, reconfigure the Start event to start with one or more SharePoint events.

Steps:
  1. Open your workflow. You can either do this from the K2 Application page of the SharePoint list and select Edit, or locate your workflow in the K2 Designer and select Edit.ImageImage
  2. Click the Trash Bin icon to remove the SharePoint event from the workflow Start step.
    Image
  3. On Delete Workflow events from a List/Library, click Delete Event.
    Image
  4. Click OK to delete the event.
    Image
  5. Notice that there are no events configured for the workflow to start.
    Image
  6. Save the workflow but do not deploy.

After making this change, if items are added to the SharePoint list, information messages are not logged in the Window Event Viewer. Once you are ready to deploy the workflow, configure the Start step to start the workflow with one or more SharePoint events and then deploy it.

Scenario 2: Deleted Workflow

Issue

For this scenario, you create a list, but the same principle applies to a library. You integrate the list with K2 for SharePoint and select to generate a workflow that starts when an item is added to the list. The workflow opens in the Workflow Designer where you start configuring it by adding steps. In this scenario, you deploy the workflow.

At some point, after you deploy the workflow, an administrator uses K2 Management to delete the workflow. They browse to K2 Management > Workflow Server > Workflows > {folder} > {workflow name}  and then click Delete and delete all versions of the workflow.)

Image

Deleting a workflow from the K2 Management site removes only the deployed workflow. The workflow definition, however, is not deleted which means that you can access it using the K2 Application page in SharePoint or the K2 Designer.

The following information message shows in Windows Event Viewer:

“A SharePoint Remote Event Receiver tried to start the workflow <workflowname> that does not exist on the server”.
Image

Prior to the K2 Cloud Update 6 / K2 Five 5.2 release, you see four error messages in the Windows Event Viewer.

Workaround

At this point, the workflow is deleted and there is no longer a deployed workflow to be started. Until you deploy the workflow again, this error message will show in the Event Viewer every time an event starts from SharePoint.

If you want to prevent these messages, delete the workflow from the artifacts page as well as the SharePoint events stored in K2.

Steps:
  1. First, go to the K2 Application page of the SharePoint list. Select the workflow and click Delete. This deletes the definition of the workflow.

    Even though you deleted the deployed version of the workflow, you can still open the worklfow from the K2 Application page, in design mode, and redeploy it.

  2. Next, you need to make some SmartObject calls to run the Remove Remote SharePoint Events method to delete the configuration of the event. In the steps below, you find your SiteURL and ListID in step a. You use these IDs to locate the SharePoint Integration EventID in step b. Then you remove the remote SharePoint events in step c.
    1. Open K2 Management and browse to the SharePoint Integration Setting SmartObject. (System > SharePoint 2013 Integration). On the Definitions tab, scroll down to the Methods section and locate the GetList method. Click Execute.
      Image

      On the Execute SmartObject Method page, click Execute.
      Image

      On the Results tab, find your list and copy (Ctrl+C) the row containing the ID, SITEURL and LISTID values and paste them into Notepad for later reference.
      Image

      You can add a filter to make things easier. For example, search by SiteURL and List Display Name.

    2. In K2 Management browse to the SharePoint Integration Setting Events SmartObject. (System > SharePoint 2013 Integration). On the Definitions tab, scroll down to the Methods section and locate the GetList method. Click Execute.
      Image

      On the Execute SmartObject Method page, click Execute.
      Image

      Reference the Notepad file you created (in step a) and find the ID.
      Image

      You use this ID to locate the correct record. (ID = SharePoint Integration Setting ID) On the Results tab, find your list’s SharePoint Integration Event ID (in this example 10001). Add this to your list in Notepad.
      Image

    3. From K2 Management browse to the SharePoint Integration Helper Methods SmartObject. (System > SharePoint 2013 Integration). On the Definitions tab, scroll down to the Methods section and locate the Remove Remote SharePoint Events method. Click Execute.
      Image

      Use your values in Notepad, paste the SiteURL, ListID, and RemoteReceiverTypes into the Value fields. Click Execute.

      Image
  3. The Remote Event Receiver is removed. This means that if an item is added to the SharePoint list, you no longer see a message in the Windows Event Viewer.