cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
igel2187
Level: Powered On

Re: Trigger a flow when a SharePoint list item field is updated.

 
igel2187
Level: Powered On

Re: Trigger a flow when a SharePoint list item field is updated.

Hi Mona Li,

 

how can I found trigger 'when an exisitng item is modified"

I only have these one.

 

 

12-07-17 11-30-09 AM.png

Bizzo
Level 8

Re: Trigger a flow when a SharePoint list item field is updated.

I don't think there is a trigger for "When an item is modified". You have to use "When an item is created or modified" and build your logic accordingly.

Community Support Team
Community Support Team

Re: Trigger a flow when a SharePoint list item field is updated.

Hi @igel2187,

 

Like @Bizzo said, now Flow has been updated and the trigger When an exsit item is modified is removed and you should use "When an item is created or modified" instead.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
cricafu
Level: Powered On

Re: Trigger a flow when a SharePoint list item field is updated.

Hi @v-monli-msft,

 

Does the trigger "When an item is created or modified" work when a drop down field/column in a list item is changed? 

 

I have an "Approve/Reject" column in a list item and I tried to set-up a Flow that would send an email notification once the user selects either Approve or Reject from the drop down field. However, nothing seems to happen. I have read in some discusion thread that the drop down control is not supported by Flow trigger....am I right? 

 

Any suggestions?

 

Thanks

vikrantbehal
Level: Power Up

Re: Trigger a flow when a SharePoint list item field is updated.

How about simple condition like

 

'Created' 'is not equals to' 'Modified'

 

If yes - //logic

if no - Terminate flow with Succeeded status

 

Lexnnn
Level: Powered On

Re: Trigger a flow when a SharePoint list item field is updated.

I have an approval process for list items and I wanted to send an approval email only when the status of the item changed from "Ordered" to "Ready".
 
The change of the status "Ordered" to "Ready" is an automized process so I though I would just put a "Wait until" or "Wait" function but this was not possible as the wait time is not always the same. I wanted to send an approval email from the moment it's ready so I have searched for a solution where there would be a check on a specific field. 
 
I tried using switch case or condition but there was a problem when other fields were updated and the condition was already fulfilled, it would send again an approval email:
eg item changed - Status is not "Ready" = Terminate (that's OK)
item changed - Status is "Ready" = send approval email (that's correct) but now item is changed again, other field is updated and the status is still "Ready" = approval email resent (that's not correct as it does not check what was updated" 
 
I did not want to use nested conditions or switch cases.
The solution link provided by grahampasmurf with version checking did the trick!! http://johnliu.net/blog/2018/5/microsoft-flow-sharepoint-trigger-on-specific-fields-changed-via-sp-h...
 
Thank you for that!
 
It did require some adaptation but it works!
 

flowemail1.PNGflowemail2.PNG

 

- ID can be found in "See more" Dynamic content
- SPREST-Versions is just renamed "Send HTTP request to Sharepoint"
- In the Url, if you use space or other special chars, you need to pay attention to how it's written eg space = %20
- Value is the expression from the linked website Body('SPREST-Versions')?['value']
- Orderstatus = valuefield "ValoTeamwork" is not found via Dynamic content but via Output from "Select" When I used the Dynamic content value it did not work as "Valo Teamwork" contained the actual value and was passing it throung to "GroupSiteUrl" from Dynamic content which remaind always the same.
- HTML table is not needed but usefull to debug and make sure it works correctly
- Conditions can again be found on the linked website: first(body('Select'))?['Orderstatus'] - last(body('Select'))?['Orderstatus']

More about approval flow

https://powerusers.microsoft.com/t5/Using-Flows/Flow-and-SharePoint-List-Status/m-p/132299#M3532

DTutt
Level: Powered On

Re: Trigger a flow when a SharePoint list item field is updated.

I do not have the "When an existing item" listed. How do i get that listed?

Lexnnn
Level: Powered On

Re: Trigger a flow when a SharePoint list item field is updated.

"When an existing item is modified" is only available when you create a new flow, it's the initial trigger same as "when an item is created", it's always on top and can not be in the middle of the flow. When you create a new flow, you can choose for it.

DTutt
Level: Powered On

Re: Trigger a flow when a SharePoint list item field is updated.

Oh ok. Thanks a lot. They need to make that available at any time. Would open up a lot of possibilities.

Sarnst
Level: Powered On

Re: Trigger a flow when a SharePoint list item field is updated.

When running the Http request with the - _api/web/lists/getbytitle("zzTest")/items(@{triggerBody()?['ID']})/versions?$top=2 it returns the following error:


{
  "status": 400,
  "message": "{\"odata.error\":{\"code\":\"-1, Microsoft.SharePoint.Client.InvalidClientQueryException\",\"message\":{\"lang\":\"en-US\",\"value\":\"The expression \\\"web/lists/getbytitle(\\\"zzTest\\\")/items(1)/versions\\\" is not valid.\"}}}\r\nclientRequestId: 3cb27048-f995-4e07-ab4c-bd3dbd9baf3d\r\nserviceRequestId: 0d8da49e-f0b4-7000-4dda-d8d0041f4589",
  "source": "https://COMPANYNAME.sharepoint.com/sites/PHForum/_api/web/lists/getbytitle(%22zzTest%22)/items(1)/ve...",
  "errors": []
}

 

When entering the URL in the browser it provides me following information, i am not sure where i need access in order to be provisioned with the correct return:


<?xml version="1.0" encoding="UTF-8"?>
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-2147024891, System.UnauthorizedAccessException</m:code>
<m:message xml:lang="en-US">Access denied. You do not have permission to perform this action or access this resource.</m:message>
</m:error>

 

Would you know?

Bizzo
Level 8

Re: Trigger a flow when a SharePoint list item field is updated.

I would recommend you try a quick test using JSOM. You should be able to modify the code below and run it in your console. The error message you get back (assuming it fails) will hopefully provide more information to help troubleshoot the problem.

 

Source

 

function retrieveListItems(siteUrl) {
    var clientContext = new SP.ClientContext(siteUrl);
    var oList = clientContext.get_web().get_lists().getByTitle('Announcements');

    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml(
        '<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' + 
        '<Value Type=\'Number\'>1</Value></Geq></Where></Query>' + 
        '<RowLimit>10</RowLimit></View>'
    );
    this.collListItem = oList.getItems(camlQuery);

    clientContext.load(collListItem);
    clientContext.executeQueryAsync(
        Function.createDelegate(this, this.onQuerySucceeded), 
        Function.createDelegate(this, this.onQueryFailed)
    ); 
}

function onQuerySucceeded(sender, args) {
    var listItemInfo = '';
    var listItemEnumerator = collListItem.getEnumerator();

    while (listItemEnumerator.moveNext()) {
        var oListItem = listItemEnumerator.get_current();
        listItemInfo += '\nID: ' + oListItem.get_id() + 
            '\nTitle: ' + oListItem.get_item('Title') + 
            '\nBody: ' + oListItem.get_item('Body');
    }

    alert(listItemInfo.toString());
}

function onQueryFailed(sender, args) {
    alert('Request failed. ' + args.get_message() + 
        '\n' + args.get_stackTrace());
}

 

Sarnst
Level: Powered On

Re: Trigger a flow when a SharePoint list item field is updated.

thx for this but i am not a developer so am not familiar with tools to check etc, i would need to figure out another way why this line does not work. which is a pity.

Bizzo
Level 8

Re: Trigger a flow when a SharePoint list item field is updated.

In your browser, clicking F12 will get you developer tools. When that opens, looks for something that says Console. Click to set your cursor in the window, paste the following code, and press enter.

 

function retrieveListItems() {
    var clientContext = new SP.ClientContext.get_current();
    var oList = clientContext.get_web().get_lists().getByTitle('zzTest');

    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml(
        '<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' + 
        '<Value Type=\'Number\'>1</Value></Geq></Where></Query>' + 
        '<RowLimit>10</RowLimit></View>'
    );
    this.collListItem = oList.getItems(camlQuery);

    clientContext.load(collListItem);
    clientContext.executeQueryAsync(
        Function.createDelegate(this, this.onQuerySucceeded), 
        Function.createDelegate(this, this.onQueryFailed)
    ); 
}

function onQuerySucceeded(sender, args) {
    var listItemInfo = '';
    var listItemEnumerator = collListItem.getEnumerator();

    while (listItemEnumerator.moveNext()) {
        var oListItem = listItemEnumerator.get_current();
        listItemInfo += '\nID: ' + oListItem.get_id() + 
            '\nTitle: ' + oListItem.get_item('Title');
    }

    alert(listItemInfo.toString());
}

function onQueryFailed(sender, args) {
    alert('Request failed. ' + args.get_message() + 
        '\n' + args.get_stackTrace());
}

retrieveListItems();

I made a couple simple changes from the original code copied from Microsoft. You need to be on a page from the site with the list, zzTest. Make sure your list has a few items in it. Other than that, it's ready to go. Hopefully that helps!

 

sharepoint_get-list-items_chrome-console.png

Edit: Added screenshot of Chrome developer tools.

Sarnst
Level: Powered On

Re: Trigger a flow when a SharePoint list item field is updated.

Thanks for this

In Edge

All i receive on Edge is 'SP is not defined'

SCRIPT5009 'SP' sp is not defined

and the same on Chrome

I tried this with 2 users one which has site collection admin rights

 

Bizzo
Level 8

Re: Trigger a flow when a SharePoint list item field is updated.

My apologies. Apparently this won't work on a Modern site. There's a few workarounds on GitHub, but I don't think it makes sense to go that far. You'll need to find another way to test this and get more info. Sorry... 😞

b8zz8
Level: Power Up

Re: Trigger a flow when a SharePoint list item field is updated.

Hello.  Hope you can help.

 

Your instruction worked perfectly, but you mentioned doing the following 

 

"IMPORTANT - last step in this side of the flow needs to set Revised Inspection Date Original equal to Revised Inspection Date."

 

How do you do that?  What control do you use to make that happen?  Help!!!

Bizzo
Level 8

Re: Trigger a flow when a SharePoint list item field is updated.

That's great you got it working! 🙂

 

Add one final step to your flow: SharePoint -> Update item. In that step, you'd leave everything "as is" and update Revised Inspection Date Original to equal Revised Inspection Date. Something like this.

 

microsoft-flow_single-field-updated_final-update.png

 

Hopefully that makes sense, but please let me know if you have any questions.

keysteck
Level: Power Up

Re: Trigger a flow when a SharePoint list item field is updated.

I am having a similar issue witht the notifications, but I would only like to get notified when 1 item in the list get changes. Its a check box that would be set from true to false. Right now, I am getting notified for all changes that are being made to the list, and just had to delete about 200 emails.

JimmyWork
Level 8

Re: Trigger a flow when a SharePoint list item field is updated.

Hi i have tried to get my flow to work this way.

My column i want to check is called Comments, it contains multiple lines of text and i just want the flow to check if this have been updated if yes send email.

 

I get this when error.

BadRequest. The 'from' property value in the 'select' action inputs is of type 'Object'. The value must be an array.

 

Im not a coder, i do understand that maybe the column cant be a text column?

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (6,206)