SOLVED

SharePoint Modern Page - Notifications when submitting Comments

Brass Contributor

On a modern page when someone post a comment, notification is sent to person who created the page. I'm looking for an option to change this so notifications are sent to another person, tried changing 'Author' to the desired user but notifications are still sent to 'Created By' user. Is this by design or is there a workaround?

2 Replies
best response confirmed by mvnair (Brass Contributor)
Solution

@mvnair you can change the Created by column using some JSON and a small flow in Power Automate.

 

Create a flow in Power Automate and make sure you add a text input for Owner Email; you will enter the first part of the new owner's email (before the @) when you trigger the flow from the list.

1-Flow.png

 

For the Uri the syntax is
_api/web/lists/getByTitle('Site Pages')/items(ID)/validateUpdateListItem

 

and you select ID from the dynamic content box.

 

The body of the Send an HTTP request to SharePoint is as follows and you select owner email from the dynamic content box.

{
"formValues":[
{
"FieldName": "Author",
"FieldValue": "[{'Key':'i:0#.f|membership|{Owner Email}@wsp.com'}]"
},
{
"FieldName": "Editor",
"FieldValue": "[{'Key':'i:0#.f|membership|Owner Email}@wsp.com'}]"
}
],
"bNewDocumentUpdate": true
}

 

Save your flow and copy its ID as you'll need this next.

 

In your site pages library add a single line of text column and format it with the following JSON. Change the id in the actionParams line to your flow's ID. Change the txtContent text to whatever you want and also change/add to the style. You can also change the text that triggers the flow; I've changed it to "Go".

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "txtContent": "Change Owner",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "='{\"id\":\"5eddbaca-e7df-46f4-b968-f009ed9f69ec\", \"headerText\":\" ' + [$Title] + '\",\"runFlowButtonText\":\"Go\"}'"
  },
  "style": {
    "background-color": "#fff5dd",
    "border-radius": "10px"
  }
}

 

That will add a button to each page in the library:

 

0-SP.png

 

When you click the button a panel will open for you to enter the first part of the email address of the new owner (created by):

2-SP.png

 

Once you click go the flow runs and after a few seconds the name is changed in the Created by column. That person will now receive notifications.

 

3-SP.png

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)

 

Thanks Rob.
I wish I saw this post sooner as I found these steps on another resource and implemented the flow, only difference was that I didn't have to use the format "i:0#.f|membership|" but I used a manual trigger with input email control to enter Created By and Modified By fields as for me this was a one time task on one .aspx page in Site Pages.

So if I peek the code this is how it looks:

 

"FieldName": "Editor", "FieldValue": "[{'Key':'@{triggerBody()?['email']}'}]"

Thanks this is fixed now.

1 best response

Accepted Solutions
best response confirmed by mvnair (Brass Contributor)
Solution

@mvnair you can change the Created by column using some JSON and a small flow in Power Automate.

 

Create a flow in Power Automate and make sure you add a text input for Owner Email; you will enter the first part of the new owner's email (before the @) when you trigger the flow from the list.

1-Flow.png

 

For the Uri the syntax is
_api/web/lists/getByTitle('Site Pages')/items(ID)/validateUpdateListItem

 

and you select ID from the dynamic content box.

 

The body of the Send an HTTP request to SharePoint is as follows and you select owner email from the dynamic content box.

{
"formValues":[
{
"FieldName": "Author",
"FieldValue": "[{'Key':'i:0#.f|membership|{Owner Email}@wsp.com'}]"
},
{
"FieldName": "Editor",
"FieldValue": "[{'Key':'i:0#.f|membership|Owner Email}@wsp.com'}]"
}
],
"bNewDocumentUpdate": true
}

 

Save your flow and copy its ID as you'll need this next.

 

In your site pages library add a single line of text column and format it with the following JSON. Change the id in the actionParams line to your flow's ID. Change the txtContent text to whatever you want and also change/add to the style. You can also change the text that triggers the flow; I've changed it to "Go".

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "txtContent": "Change Owner",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "='{\"id\":\"5eddbaca-e7df-46f4-b968-f009ed9f69ec\", \"headerText\":\" ' + [$Title] + '\",\"runFlowButtonText\":\"Go\"}'"
  },
  "style": {
    "background-color": "#fff5dd",
    "border-radius": "10px"
  }
}

 

That will add a button to each page in the library:

 

0-SP.png

 

When you click the button a panel will open for you to enter the first part of the email address of the new owner (created by):

2-SP.png

 

Once you click go the flow runs and after a few seconds the name is changed in the Created by column. That person will now receive notifications.

 

3-SP.png

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)

 

View solution in original post