Trigger a Cloud Flow when CSS web files are modified in Power Pages (Standard Data Model)

Sometimes when multiple developers work on the same Power Pages site using Power Platform CLI or changing WebFiles/WebTemplates via browser we might have update conflicts.

One special case is when we have custom styles developed using SCSS and not pure CSS.

We can have more than I developer working on separate partials and using Fiddler to test updates locally, but for the updates to take effect in the Power Pages site for other people that are not the developer, the SCSS content needs to be compiled into CSS and updated in the Power Pages site.

And if someone makes a change without merging the separate partials from other developers if there were parallel changes, we can have issues.

To avoid that to happen and have less effort on communications, we can use Power Automate to notify the team when changes happen specifically on CSS files.

Overview of the solution

WebFiles binary content on the Standard data model are stored in the Notes (annotations) table (Attached to the WebFiles records in the adx_webfile table). So what we need to do is:

  • Trigger a flow when a css file is added/updated in a Note record and it relates to a webfile
  • Process data related to who changed/file details
  • Notify relevant people

Trigger For the Flow

For the above idea to work, created a Power Automate cloud flow with the Dataverse connector.

Trigger: When a row is added, modified or deleted

Change Type: Added or Modified

Scope: Organization

Filter rows: (objecttypecode eq ‘adx_webfile’ and (endswith(filename,’.css’) or mimetype eq ‘text/css’))

This ‘filter rows’ query will only filter notes that related to Power Pages web files and have the attachment with css mime type or css extensions.

You can them use the note ID to retrieve more details, and also get the related WebFile details using the Regarding (Value) field:

Then with all that information use compose actions to build your email body and text:

Subject:

The WebFile @{outputs('Get_a_row_by_ID_-_AdxWebfile')?['body/adx_name']} (@{outputs('Get_a_row_by_ID_-_Note')?['body/filename']}) was Modified by @{outputs('Get_a_row_by_ID_-_Note')?['body/_modifiedby_value@OData.Community.Display.V1.FormattedValue']} 

Body:

Hello Developers,<br/><br/>

The CSS file <b>@{outputs('Get_a_row_by_ID_-_Note')?['body/filename']}</b> (Webfile: @{outputs('Get_a_row_by_ID_-_AdxWebfile')?['body/adx_name']}) was modified by <b>@{outputs('Get_a_row_by_ID_-_Note')?['body/_modifiedby_value@OData.Community.Display.V1.FormattedValue']}  </b> 
<br/><br/>

To wrap up, use the Outlook connector to send emails to the people you want (or you can also notify via teams connector).

Results

When changes are made to Web File, you will get notified about it and who made the changes:

References

Trigger flows when a row is added, modified, or deleted – Microsoft Learn

Leave a Reply

Your email address will not be published. Required fields are marked *