Thursday, December 14, 2017

Problem with terminated site workflows which continue working in Sharepoint Online

Recently we faced with interesting issue in Sharepoint Online: there were several 2013 site workflows on different sub sites which worked this way:

  1. Iterate through publishing pages in Pages doclib of the current site and if current date is close to page’s Valid to date, workflow sends reminder email to responsible person
  2. Wait 1 day and then repeat iteration through pages

i.e. by itself workflow never ends. However it is possible to terminate workflow from UI: Site contents > Site workflows > click workflow > End workflow (see my previous post Restart site workflows in Sharepoint Online)

We published new version from Sharepoint Designer, ended previous workflow instances from UI and started new instances. And here we found interesting issue: terminated workflow instances continued to work, i.e. they continued to send emails of previous version to the users. In UI their status was displayed as Terminated. At the moment we contacted MS support but if you know about this issue please share it in comments.

Monday, December 11, 2017

Install SPFx React Script editor web part as tenant-scoped solution into Sharepoint Online

How it is said in the following MS article Tenant-Scoped solution deployment for SharePoint Framework solutions, it is possible to make SPFx solution tenant scoped. According to documentation components installed with such solution will become immediately available cross the tenant after solution package will be installed to tenant app catalog. Let’s check few internal details of tenant-scoped solutions using Script editor web part for modern pages built in React as example.

Before to start we will need to install the following prerequisites:

  • git for Windows
  • nodejs for Windows
  • also I usually need to globally install gulp
    npm install -g gulp
    and add resolved folder %appdata%\npm to PATH environment variable

So first of all we need to clone git repository with web part code:

git clone https://github.com/SharePoint/sp-dev-fx-webparts.git

After that go to ~/sp-dev-fx-webparts\samples\react-script-editor and run the following commands:

npm install

which will install necessary dependencies into node_modules subfolder (there are more that 1600 dependencies so it will take some time). After that edit config/package-solution.json file: add "skipFeatureDeployment": true there:

it will make our solution tenant-scoped. Also edit config\write-manifest.json file: set cdnBasePath variable to your CDN path, e.g.

https:<tenant>.sharepoint.com/sites/CDN/SiteAssets/SPFx/react-script-editor

After that run the following commands:

gulp --ship

gulp package-solution --ship

First one should create temp folder. You need go to its deploy subfolder and copy files from there to specified CDN. Second command will create sharepoint/solution folder with pzl-script-editor.sppkg file. This file is zip file so if we will unzip it and check AppManifest.xml we will find that it has SkipFeatureDeployment=”true” attribute:

Now deploy to App catalog and enable "Make this solution available to all sites in the organization" option:

After that solution should be available on all sites of your tenant.

Thursday, December 7, 2017

Restart site workflows in Sharepoint Online

Once you have published or made changes in existing site workflow in Sharepoint Online site you will need to restart existing running workflow instances in order to get new changes into use (otherwise they won’t take effect). In order to restart existing site workflow instance in Sharepoint Online you may use the following steps. Go to Site settings > Site contents and click “Site workflows” link on the top of the page:

Opened page will show list of all available site workflows together with list of running workflows and list of completed workflows:

If you will click on some workflow name from the top list – it will be started. If you will click on some running workflow instance workflow details page will be opened:

On this page there is a link “End workflow” (it looks like regular text, not as a link). By clicking this link you may stop existing workflow instance, then return to previous page and start new instance which will use new published workflow version.