Stop and Restart Workflow on Item Edit (sharepoint online)

How can I stop running the workflow instances for the current updated list item?
I mean, how can I recognize the item that just updated and how can I stop the workflow
that access with this item? in s.p online.
thank you! 

Hi,
According to your post, my understanding is that you wanted to cancel workflow in SharePoint online.
We can pass the ID of the list & list item to get all the instances, then you can enumerate each of them and find the one you want to suspend or terminate.
To pass the ID of the list and list item, you can refer to the following code snippets.
// connect to the workflow services via a CSOM client context
var clientContext = new ClientContext(siteCollectionUrl);
var workflowServicesManager = new WorkflowServicesManager(clientContext, clientContext.Web);
// connect to the instance service
var workflowInstanceService = workflowServicesManager.GetWorkflowInstanceService();
// get all instances
var workflowInstances = workflowInstanceService.EnumerateInstancesForListItem(listId, listItemId);
clientContext.Load(workflowInstances);
clientContext.ExecuteQuery();
Then we can find the list item workflow to suspend as below.
foreach (var instance in workflowInstances)
// is this what we are looking for?
// if so, suspend it
workflowInstanceService.SuspendWorkflow(instance);
// or you can terminate it
workflowInstanceService.TerminateWorkflow(instance);
http://sharepoint.stackexchange.com/questions/69366/how-do-we-stop-a-sharepoint-2013-workflow-azure-workflow-programmatically
Thanks & Regards,
Jason
Jason Guo
TechNet Community Support

Similar Messages

  • Stop and Restart Workflow on Item Edit

    Using Event Receivers can we stop running the workflow instances for the current list item?

    You will have to use full trust proxies to achieve that. Read more about it here.
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/ebf93556-3f2d-473f-86df-b446ab15e52b/alternatives-to-the-use-of-spsecurityrunwithelevatedprivileges-in-a-web-part-sandbox
    http://blah.winsmarts.com/2009-12-SharePoint_2010_Sandboxed_Solutions__Full_Trust__Proxies.aspx
    http://msdn.microsoft.com/en-us/library/ff798482.aspx
    I am assuming you are not using SharePoint Online. 
    Amit

  • When using the "Books" app on my ipod touch, if I open one of my books there is no way to return to the library without stopping and restarting the app. What am I doing wrong?

    Once I open a book in my library there is no option to close it and return to the library. I must leave the app, stop the app and then restart it. How do I exit an opened book to return to my library without having to exit, stop, and restart the app?

    Assuming you are talking about "iBooks", then just
    tap the center of the screen
    and you should see a "Library" in the upper left corner of the screen.
    tap the center of the screen again,
    and you should return to full screen mode.
    if this is NOT iBooks, then I do not know what controls that app

  • Why do I need to stop and restart web server?????

    I am developing servlets on sun's standard web server as well as with Netscape's web server.
    The problem is every time I make any changes to servlet and recompile my code, changes are not visible until I stop and restart web server. I guess web server uses cached version of servlet.
    Can any body help me to solve this problem? It is matter of some setting issues in web server. But since I am novice, I don't know.........

    Some app servers have a "reloadable" attribute that can automatically detect changes in your servlet and reload your application for you. Not sure if all do though... but check through the docs on your app server and see if there's something similar. If not, you're probably stuck manually restarting.

  • APEX 4.2 aligning issue of Stop and Start Grid Layout item

    My APEX application application is in the process of moving from 4.0 to 4.2.  I am experiencing an issue with aligning (left margin justified) of Stop and Start Grid Layout items that have a border around them.  Earlier I had an issue with the border itself not showing up in the 4.2 application.  I was able to resolve that with a workaround by adding inline code in the CSS section of the page: #P23_OFFICE_START_TBL {width:682; border:1px solid #369; margin:5px;}. This created the border which I needed, but there are 2 Stop and Start Grid Layout items that are indented and not aligning with the border of the previous line.  I have tried a number of different things but none of them have worked.  This seems like a very simple issue to fix but I am having a tough time resolving it.
    I tried to put the item in question in a different grid, which corrected the indention but then I lost the border around the item.  It seems that the above CSS code does not work on the new grid.  I also tried to put attributes such as margin-left:5px; float: left; clear: left; float: left, in the CSS code but that did not work, too.
    Any suggestions?
    Thanks
    Ajay K

    I deleted and added back the Stop and Start Grid Layout items not aligning properly.  This worked.  Apparently, the 4.0 to 4.2 upgrade did not handle/convert these items properly.  Deleting and adding them back resolved the issue.

  • Start, stop and restart while loops

    Hi, my qustion is i have 2 example a and example b. Example b lets u start counting up in seconds when u want to. as long as the toggle switchs are in correct position. it also lets u start, stop and restart if need be. i want to be able to that with example a, but for some reason the while loop always sets of running independent of what position the the toggle switch. Any help greatly appreciated.
    Thanks Stuart
    Attachments:
    examplealib.llb ‏202 KB
    exampleb.vi ‏25 KB

    An example as the attachment.
    Attachments:
    switch.vi ‏23 KB

  • I have tried to download a movie via iTunes. Every time the download nears the end, it stops and restarts from the beginning. This has happened 5 times. Any solutions?

    I have tried to download a movie via iTunes. Every time the download nears the end, it stops and restarts from the beginning. This has happened 5 times. How can I clear the download or solve this?

    If it is a HD movie, it may not be enough. The iPad also need working space.
    Try download to iTune (computer) and "Move" to iPad.

  • Can a subVI tell when the application it is part of has been stopped and restarted?

    Can a subVI tell when the application it is part of has been stopped and restarted?
    It is easy enough for a subVI to tell when it has been run for the first time after having been loaded into memory. But is there a way for a subVI to tell when the application it is part of has been stopped and restarted? Is there some property or application-invocation-specific refnum that when queried multiple times during the same run of the application would return the same value yet when queried during different runs of the application would return different values?
    I don�t want to depend on anything that happens when a run is exited.
    I don�t want to require code to be included in the main V
    I to accomplish the solution.
    (Otherwise I could, in the main VI create an un-named semaphore tied to a global; the subVI could then check the global to see if the value changed, which it would between runs of the application.)
    Any ideas?

    Have you tried the First Call? function? It's on the Advanced>Synchronization palette.

  • Video podcast stops and restarts

    with one of my podcasts (Bush League TV), it will download completely, but after i sync it to my iPod, whenever it reaches a certain point it will stop and restart. Whenever i play it in iTunes it plays alright but is sorta slow and skippy. i have tried deleting it and then redownloading it. any ideas?

    Nobody?

  • Shell script to start, stop and restart a JAR

    Hi everyone,
    Does anyone have idea to write a shell script to start, stop and restart a JAR under linux? it can indicate a method or parameter? Thanks!
    this JAR inculdes a class with main method like this:
    public class Client(){
      public Client(String name){
      public void stopClient(){
      public static void main(String[] args){
         new Client("/tmp/text.log");
    }

    Does anyone have idea to write a shell script to
    start, stop and restart a JAR under linux? That part isn't really clear.
    Start would be java -jar myjar.jar.
    Stop could either be kill, which kills the whole process; kill -TSTP, which suspends the process, or some application-specific communication such as sending something over a port; or putting something into a file or something.
    Restart could just be the same as start (if stop is just kill); kill -CONT, if stop was kill -TSTP; or some other app-specific communication.

  • Shell script to start, stop and restart a JAR under linux

    Hi everyone,
    Does anyone have idea to write a shell script to start, stop and restart a JAR under linux? it can also indicate a method or parameter? Thanks!
    this JAR inculdes a class with main method like this:
    public class Client(){
    public Client(String name){
    public void stopClient(){
    public static void main(String[] args){
    new Client("/tmp/text.log");
    }

    Does anyone have idea to write a shell script to
    start, stop and restart a JAR under linux? That part isn't really clear.
    Start would be java -jar myjar.jar.
    Stop could either be kill, which kills the whole process; kill -TSTP, which suspends the process, or some application-specific communication such as sending something over a port; or putting something into a file or something.
    Restart could just be the same as start (if stop is just kill); kill -CONT, if stop was kill -TSTP; or some other app-specific communication.

  • Using cron to stop and restart password protected instance (App Server 7)

    I have been asked by a customer to create a cron job to stop and restart their web application running under Applications server 7.
    I have created the script and can stop the instance, but I am unable to start it as it is asking for a password.
    I have included this in the script but it doesn't seem to like having a password supplied this way.
    Am I doing something wrong or Are there any alternative ways of stopping and restarting an application, using Cron?

    Have you looked at using password.conf file as described in --
    http://docs.sun.com/source/816-7155-10/crcfgfil.html#1075615
    You might also want to look at --
    http://docs.sun.com/source/816-7156-10/agsvrprf.html#1019453

  • How to Stop and restart the midtier?

    Hello All,
    I have installed Oracle AS (Infraturcture & middle tier , BI & Forms) on same Linux box.i.e: Oracle As 10.1.2.0.2 (Rel 2, x86 for Linux), SLES 9
    Here is my question:
    How to Stop and restart the midtier?
    Regards,
    DN

    biforms.sh
    export ORACLE_HOME=/opt/oracle/biforms
    export OH=$ORACLE_HOME
    export PATH=$OH/bin:$OH/opmn/bin:/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/bin
    export ORACLE_SID=ORCL
    export LD_LIBRARY_PATH=$OH/lib:/usr/openwin/lib:/usr/dt/lib:/usr/lib:/tools/lib
    infra.sh
    export ORACLE_HOME=/opt/oracle/infra  <-- or correct one!
    export OH=$ORACLE_HOME
    export PATH=$OH/bin:$OH/opmn/bin:/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/bin
    export ORACLE_SID=ORCL
    export LD_LIBRARY_PATH=$OH/lib:/usr/openwin/lib:/usr/dt/lib:/usr/lib:/tools/libAs you see, only the first row differs from these two scrips. Because I'm lazy, I usualy set export OH. Under certain circumstances you might want to add DISPLAY to biforms.sh. Set it to localhost:0 or whatever is correct.
    Martin

  • How to Stop and restart the OC4J_BI_FORMS?

    I have Oracle AS 10.1.2.0.2 (Rel 2) installed. (Infratsructure & BI & Forms) on same computer.
    my question is :
    How to Stop and restart the OC4J_BI_FORMS?
    Regards,
    DN

    Just as any other OC4J:
    opmnctl stopproc -process-type=OC4J_BI_FORMS
    opmnctl startproc -process-type=OC4J_BI_FORMS
    or
    opmnctl restartproc -process-type=OC4J_BI_FORMS
    cu
    Andreas

  • Have to stop and restart Q-Master for it to show up in Compressor 3.5.1 SL

    I am having a problem with Q-Master in Snow Leopard, running compressor 3.5.1, where every time I restart, when I go into compressor, it does not show up my Q-Master cluster. Instead I must go into the control panel (which has to restart into 32 bit mode, COME ON APPLE LETS MAKE Q-MASTER 64 BIT!) and stop and restart Q-Master and then it shows up in Compressor.
    Is this because the control panel has to be in 32 bit mode for it to work? Is anyone else having a similar problem?

    I have the exact same thing happening!!! Funny how you haven't got a response to fix the issue. I called Apple and the guys said I needed to reformat my drive and install FCS from scratch to get rid of any files from FCS 2, only because I used some FCP utility to remove the previous version.< </div>
    Sorry you got that advice from Apple. Reinstalling Apple software is rarely effective and a scorched earth approach rarely solves anything. It simply takes everything back to a default state.
    I've had this same issue with Qmaster on my system and I'm still running 10.5+ so it's not a Snow Leopard issue. I solved it, at least for now, by simply deleting Qmaster only and reinstalling just Qmaster. However, I deleted and installed Qmaster to solve a problem with FCP; it was crashing immediately upon launch.
    This is important: I have no way of knowing if there is a direct or causal relationship between any of these events.
    bogiesan

Maybe you are looking for