Coming from a Dynamics CRM/ Dataverse background and having written plugins and later flows using Common Data Service (Current Environment) connector, I was a little lost looking at the SharePoint trigger for When a list item is added or modified.
With the CDS (CE) connector, when you use the When an item is created, updated, deleted trigger,
Using the Column filter, we could provide the list of fields/columns that if modified should the flow execute further. If none of the specified fields in the column filter were modified when this trigger was invoked, it would not execute the flow.
This is really helpful when we would like to perform an operation only if that field was updated. Say, send an email notification when a ticket is assigned to a user. We need to identify if the update was triggered because of the change in user and only then send out the email notification.
Similarly, when using SharePoint Lists as a data source, had a similar request. It was therefore required to identify if the user column had been modified in the item when the update was invoked.
There is an existing flow template available to do this.
However, this one too has the step to identify if the user field was modified missing.
When you add the SharePoint trigger;
We do not see a column filter where we can provide the list of columns that we are tracking.
To do the same in SharePoint, we need to perform the following action:
And set the following properties:
Set the SharePoint Site and List and provide the list item id for which the changes need to be tracked.
Since – should be set to the version # since when you would like to compare for changes. You could either enter a date or a version #. If you want to compare it with the original record the first time it was created set it to 1. If you would like to check for the columns that changed in this update since the last update, you need to set it to the last version # of the record.
Luckily for us, we get the version # of the current update in the trigger body.
Note: VersionNumber is not made available as a Dynamic value that we can use as it is, therefore to get the previous version number we can set Since to the following expression –
Ref: Sub function
With this included, the result of this action can now be referenced in the following steps:
Note: For Version # to be returned, you should first enable versioning on your SharePoint List.
1) Navigate to your list -> Choose the Settings gear icon at the top -> choose List Settings.
2) Here choose Versioning settings.
3) Set Item Version History to true.
With this in place, though it requires a couple of additional steps, but we are able to implement the same feature as in the CDS (CE) connector and make sure to avoid unnecessary flow step executions.
Note: The flow would be triggered, i.e. it would count towards flow run even if the user was not modified or set.
Now if you wanted to make sure that the item has a value set for the user in the first place – since we need to send an email to the user, so we need to track the user’s data and it was changed since the last update.
The change since the last update or column filter was implemented above.
To incorporate the Row/Record level filter, make use of the Trigger Condition available in the settings of the trigger.
Note: With Trigger Conditions added, if the trigger condition does not evaluate to True, the flow will not even trigger i.e. it won’t even count towards your flow runs.
Hope this helps with tracking specific column updates to SharePoint List Items.
Free 70% of storage space in CRM with Attachment Management Apps!
Attach2Dynamics – Store and manage documents/attachments in cloud storage of your choice – SharePoint, Dropbox or Azure Blob Storage from within Dynamics 365 CRM.
SharePoint Security Sync – Robust and secure solution to integrate Dynamics 365 CRM and SharePoint Security Sync thereby ensuring secure access to confidential documents stored in SharePoint.