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

How to convert a 'When New Item is created' trigger to a 'manual' trigger from a SharePoint list

Good day, I have created a workflow for my Management of Change approvals process, which is triggered when a new item is created on the 'Raise a New Change Request list'. However, I now need to be able to activate an identical (almost) flow manually, when a Change Request has been rejected by a Management of Change Team member, and has been amended and needs to be re-submitted. I want to be able to click on the amended list item, and re-submit the Change request using the manual flow trigger. I was hoping someone had a suggestion on how to change a copy of my existing flow so that it will can be triggered with the manual trigger. I have previously been able to change a trigger from a 'when_an_item_is_created_or_modified' to a 'When_item_is_created" by using the workaround of exporting the workflow as a zip package. That change worked when I • export the workflow as a zip package (option "create as new") • make sure to rename the original workflow to avoid conflicts when importing • unzip the package file, look for the definition.json file • replace the trigger by editing the file: in my case I replaced "When_an_item_is_created_or_modified" with "When_an_item_is_created" , "GetOnUpdatedItems" with "GetOnNewItems" and "onupdateditems" with "onnewitems" • recreate the zipfile (make sure the Microsoft.Flow folder is in the root of the zip file) • reimport the package, the flow is now triggered by the new action But I couldn't get it to work when I swapped "When_an_item_is_created_or_modified" with "manual". Does anyone have a suggestion on how to change the trigger from 'When an item is created' to 'manual'?
5 REPLIES 5
Community Support Team
Community Support Team

Re: How to convert a 'When New Item is created' trigger to a 'manual' trigger from a SharePoint list

Hi @AdamBradbury198,

 

You could modify the trigger 'When New Item is created' to trigger "For a selected item".

 

You could refer to link below to learn more about running a flow for a selected item:

https://flow.microsoft.com/en-us/blog/flow-in-spo-document-libraries/

 

The flow with trigger "For a selected item" would be created automatically from sharepoint and you need to manually add the other actions to the flow instead of only change the trigger from a copy flow.

 

 

Best regards,

Alice

Highlighted
AdamBradbury198
Level: Powered On

Re: How to convert a 'When New Item is created' trigger to a 'manual' trigger from a SharePoint list

 

Thank you for the response Alice.

 

Yes, the trigger "For a selected item" was the manual trigger I have been trying to switch to.

 

I almost found a work around, when I went into the .JSON file and swapped the entire section:

 

'

":{},"type":"Object"},"$authentication":{"defaultValue":{},"type":"SecureObject"}},"triggers":{"When_an_item_is_created":{"recurrence":{"interval":5,"frequency":"Minute"},"splitOn":"@triggerBody()?['value']","metadata":{"flowSystemMetadata":{"swaggerOperationId":"GetOnNewItems"}},"type":"ApiConnection","inputs":{"host":{"api":{"runtimeUrl":"https://flow-apim-msmanaged-na-westus2-01.azure-apim.net/apim/sharepointonline"},"connection":{"name... .sharepoint.com/teams/Adelaide%20testing%20page'))}/tables/@{encodeURIComponent(encodeURIComponent('67c3a2bd-91f1-4c51-a342-6c1814828e8b'))}/onnewitems","authentication":"@parameters('$authentication')"}}},"

'

 

with:

 

'

":{},"type":"SecureObject"},"sharepoint.site":{"defaultValue":"","type":"String"},"sharepoint.list":{"defaultValue":"","type":"String"}},"triggers":{"manual":{"splitOn":"@triggerBody()['rows']","type":"Request","kind":"ApiConnection","inputs":{"schema":{"type":"object","properties":{"rows":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string","x-ms-dynamically-added":true,"description":"Message to manager","x-ms-content-hint":"TEXT","title":"Message"},"entity":{"type":"object","required":["entity.ID"],"properties":{"ID":{"type":"integer","isEntityParameter":true}}}},"required":["text"]}}}},"host":{"api":{"runtimeUrl":"https://flow-apim-msmanaged-na-westus2-01.azure-apim.net/apim/sharepointonline"},"connection":{"name... .sharepoint.com/teams/Adelaide testing page","table":"67c3a2bd-91f1-4c51-a342-6c1814828e8b"}}}},"

'

 

Which then allowed the workflow to be run when I re-zipped the amended files and re-imported them.

The workflow looked correct, and it allowed me to save the flow with a new name, and test the flow by running the newly modified workflow from the SharePoint list.

 

However, while the flow would run, it would fail at every step that had dynamic content.

It appears that the dynamic content selector doesn't recognise the "When an item is selected" trigger for the links of the type: TriggerBody()['']

 

I kept on getting Error Code 404, Error Details "Resource not found" every time I tested the workflow.

 

I will now need to go into each dynamic content and delete the existing link, and create a new link of the type: Body('Get_item')['']

 

Which is annoying, as I was trying to avoid deleting all the dynamic content links and re-creating them.

 

I am surprised the flow allowed me to save it, considering all the dynamic content links were now nonsense.

 

But at least I don't have to build the entire workflow again from scratch (just repopulate all the dynamic content links).

 

I really did not want to create the trigger automatically from the SharePoint list, then have to manually add 426 things (actions/conditions/variables/scopes/for each) after that, in order to recreate the working flow. 

 

Many thanks,

 

Adam

 

AdamBradbury198
Level: Powered On

Re: How to convert a 'When New Item is created' trigger to a 'manual' trigger from a SharePoint list

I have come up against another error.

 

I built a test flow from scratch, using the 'For a selected item' trigger, but when I have gone to test it, it comes up with an error:

 

This flow cannot be triggered for testing.

 

This flow cannot be triggered for testing.png

 

Does anyone know how to fix this?

 

As it won't let me run the flow, I don't have any flow failure/error information to point out what has gone wrong.

 

Thanks,

 

Adam

Community Support Team
Community Support Team

Re: How to convert a 'When New Item is created' trigger to a 'manual' trigger from a SharePoint list

Hi @AdamBradbury198,

 

As is refered in the link:

https://flow.microsoft.com/en-us/blog/flow-in-spo-document-libraries/

 

Now when you flow is created, go back to your SharePoint list, select an item and click on the Flow menu. You’ll notice a new addition to the menu - the flow you just created,you could lick on it to run the flow,as screenshot below:

Capture.PNG 

 

 

Best regards,

Alice

AdamBradbury198
Level: Powered On

Re: How to convert a 'When New Item is created' trigger to a 'manual' trigger from a SharePoint list

Thanks Alice,

 

I have already been referencing the 'Run a flow on demand for a selected list item' section of the Blog, but thank you for thinking to send the link anyway.

 

However the flows will not run, it comes up with the OOPS 'something went wrong' fallen icecream error symbol.

To summarise what I have been doing:

 

I have been clicking on a list to create a manually triggered flow.

Using the "Request manager approval for the selected item" one as the flow template.

Editing the flow as desired.

Saving the flow.

Going to the list the flow was based on.

Selecting an item from the list.

Going to Flow.

The new flow is there.

manually trigger from list.png

Clicking to run the flow.

Getting the something went wrong message.

sorry something went wrong - wont trigger.png

Going into my flow.

Seeing that there is no way to trigger the flow.

This flow cannot be triggered for testing.png

Wondering what went wrong.

Is there anyway to see what went wrong, why a flow cannot be triggered?

 

This is doubly confusing as I have another manually triggered flow (an approval flow) that works fine.

It allows me to select the item needed the approval from the list (a different list, as this approval is later on in the Change Management Process).

a previously created manually triggered approval works.png

And will run the approval fine.

Another flow works fine when manually triggered.png

I can't see why one would work, and be triggered fine, and the other wont.

 

Is there something about the manual trigger that it will work for some custom lists, but not others?

 

This is doing my head in.

 

Many thanks,

 

Best regards,

 

Adam

 

 

 

 

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

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 Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 350 members 4,968 guests
Please welcome our newest community members: