Solved

How can I schedule a workflow to daily in office 365?


I need to schedule a workflow to daily but I can't see the scheduling option in office 365.

Any help would be appreciated.

icon

Best answer by TomaszPoszytek 15 March 2017, 20:31

View original

16 replies

Userlevel 7
Badge +17

In O365 scheduling of site workflows is not available. There are however workarounds (like a workflow with a loop and pause action, that pauses each loop execution for a day), but no such feature OOTB. Please search this forum and you will find a solution.

Regards,

Tomasz

Userlevel 7
Badge +17

You can as well use 3rd party solution. I can't recall the name at the moment. You will certainly find it searching the forum I'm answering via phone what makes such research a bit difficult

Regards,

Tomasz

Thanks again Tomasz.

I applied the loop and pause action but how can I start manually for the first time? It is a list workflow.

Userlevel 7
Badge +17

Depending on the UI, page to start workflow manually is differently accessed. Classic vs. Modern:

Regards,

Tomasz

Thanks, however this will start for a specific item. what I want is to start for all the items wherever the condition meets. I wrote a site workflow to start this list workflow using start workflow action but that also ask for specific item id

Userlevel 7
Badge +17

So to run a workflow on the whole list, you must use site workflow. But again - there will be only one instance of that workflow. I do not understand now what is your case, but.. you cannot run ONE workflow that will affect each item based on condition, in different time. Ok, you can. The site workflow, running in loop, and in each turn querying all list items seeking for those meeting conditions.

Regards,

Tomasz

Actually, I have a list which has multiple rows, each row corresponds to one system. I need a workflow  which runs daily on each row automatically and check its go live date column. If the go live date is due in 7 days or less, it will send the notification.

So, the workflow would be running on each row once in a day. I feel it would be site workflow but then will it run for all the rows?

Userlevel 7
Badge +17

imho that depends on how you will build it but it's doable

Badge +4

Hi,

you can also add a column to your list, ex : WF_Start of type yes/no

Your workflow start on modification with a runif action at top to check if WF_Start is Yes

Then do your work and at the end of your workflow set WF_Start to false

And on a server, you can write a powershell script that update all items of your list in order to set WF_Start to true and schedule it

Regards,

JM

Userlevel 7
Badge +17

Hehe, there is no "on the server" when speaking about O365 tenant

I mean - not the tenant server. But the script can be hosted on any other server with SharePoint Online PowerShell console

Regards,

Tomasz

Badge +4

Sure it's not on the tenant server of course but a server in your organization, or in azur, etc ... and SP Online PowerShell or PowerShell + CSOM, etc

Ex with Powershell + CSOM

$loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
$loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")

$username = ""
$password = ""
$url1="https://xxx.sharepoint.com/"
$bib = "your_bib"

function ActiveWorkflow($adresse) {

    $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($adresse)
    $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $(convertto-securestring $Password -asplaintext -force))

    Try
    {
        $list = $ctx.get_web().get_lists().getByTitle($bib)
        $ctx.Load($list)

        $camlQuery = New-Object Microsoft.SharePoint.Client.CamlQuery
        $camlQuery.ViewXml = '<View><Query><Where><Eq><FieldRef Name="WF_Start" /><Value Type="Integer">0</Value></Eq></Where></Query></View>'
        $items = $list.GetItems($camlQuery)
        $ctx.Load($items)
        $ctx.ExecuteQuery()

        for ($i = 0; $i -lt $items.Count; $i++) {
            $spItem =$list.GetItemById($items[$i].Id)
            $ctx.Load($spItem)
            $ctx.ExecuteQuery()

            $spItem.set_item("WF_Start",1)
            $spItem.update()
            $ctx.ExecuteQuery()
        }
    }
    Catch
    {
      [system.exception]
      $ErrorMessage = $_.Exception.Message
      Write-Host "Erreur dans le traitement : " $ErrorMessage
    }
}

ActiveWorkflow $url1

Userlevel 5
Badge +13

I have used this solution from  with much success: Scheduled Workflows in Office 365

Userlevel 7
Badge +17

Deewaker have our answers helped you? If so, can you choose one and mark it as "Correct" please?

Regards,

Tomasz

Thanks everyone. It helped a lot.

I created a site workflow with a loop and pause actions. I have a set a date until the workflow will run. The pause action will pause it for 24 hrs so that the logic could execute every 24 hrs. Hence both the problem got resolved.

Badge +5

It's in the road-map see: Schedule Site Workflow – Customer Feedback for Nintex 

Userlevel 7
Badge +11
Scheduling is now supported - https://help.nintex.com/en-US/office365/Workflows/StartEvents/ScheduledStart.htm

Reply