This discussion is archived
8 Replies Latest reply: Nov 19, 2012 10:05 AM by viktor.jarolim RSS

How to complete a manual task without enter to worklist

jgallego Newbie
Currently Being Moderated
Hi all,

I have a manual task configured with a specific expected duration time. If it reaches this time and is not executed, the task will be completed with another state. How can I completed a manual task for an specific flow, without open it in the worklist, if it reaches its expected duration time?

I am trying to use a Jeopardy with a custom automation plugin but it does not work.

The code that i use to complete the task is:

public void run(String inputXML, AutomationContext automationcontext) throws AutomationException {
          TaskContext taskcontext = (TaskContext) automationcontext;
          User usuario = null;
          try {
               taskcontext.assignTask("GrupoAseguramiento");
               taskcontext.acceptTask();
               taskcontext.completeTaskOnExit("ServicioValidado");
               
          }catch(Exception exc){     
               taskcontext.completeTaskOnExit("ClienteComunica");
          }
}


Thanks for the help
  • 1. Re: How to complete a manual task without enter to worklist
    905535 Newbie
    Currently Being Moderated
    Hi

    Replace second line of your code by following line.

    TaskNotificationContext taskcontext = (TaskNotificationContext) automationcontext;

    Also in try block call java API in following sequence.

    taskcontext.acceptTask();
    taskcontext.assignTask(taskcontext.getUser());
    taskcontext.completeTaskOnExit("ServicioValidado");

    Hope this will work for you.

    Regards,
    UJ
  • 2. Re: How to complete a manual task without enter to worklist
    viktor.jarolim Explorer
    Currently Being Moderated
    Hi UJ, why would you first accept and then assign to current user?
    The original order looked OK to me.
    When the task is accepted by another user, you first need to assign to current user and only then you can accept.
    Viktor
  • 3. Re: How to complete a manual task without enter to worklist
    jgallego Newbie
    Currently Being Moderated
    Hi UJ, I followed your instructions but it did not work

    The cartridge only contains processes, it does not have orchestration. are there any restrictions with that?

    Thanks for your help.

    Regards,
    Juan
  • 4. Re: How to complete a manual task without enter to worklist
    905535 Newbie
    Currently Being Moderated
    Hi voktor,

    As this is a manual task and there requirement is without opening worklist they want to complete manual task.
    So that manual task has to be in receive state and to work on it we have to accept it first.

    This code is working fine for me :)

    Regards,
    UJ
  • 5. Re: How to complete a manual task without enter to worklist
    905535 Newbie
    Currently Being Moderated
    Hi jgallego,

    This is simple java code and nothing related to orchestration.

    Please post error message that you are getting.

    Regards,
    UJ
  • 6. Re: How to complete a manual task without enter to worklist
    882807 Explorer
    Currently Being Moderated
    Hi UJ,

    I was just trying the method you said and am getting errors..

    Java Code:
    import com.mslv.oms.automation.plugin.*;
    import com.mslv.oms.automation.*;

    public class ManualTaskCompleter extends AbstractAutomator {

         @Override
         public void run(String orderXML, AutomationContext context)
                   throws AutomationException {
              // TODO Auto-generated method stub
              TaskNotificationContext taskcontext = (TaskNotificationContext) context;
              try
              {
                   taskcontext.completeTaskOnExit("next");
              }
              catch(Exception exc)
              {
                   taskcontext.completeTaskOnExit("finish");
              }
         }
    }

    RunTime Exceptions:
    <11-Oct-2012 2:50:29,439 IST PM> <ERROR> <automation.AutomationException> <ExecuteThread: '12' for queue: 'oms.automation'> <An automation exception has occurred At AutomationDispatcherImpl.runAutomator:/automation/plugin/internal/systemNotification/AutomationPlugin/1.0.0/T4_T4_SLA , the reason is :com.mslv.oms.automation.AutomationException: javax.transaction.TransactionRolledbackException: EJB Exception: : java.lang.ClassCastException: com.mslv.oms.automation.OrderNotificationContextBean cannot be cast to com.mslv.oms.automation.TaskNotificationContext


    Thanks
    Naveen Jabade
  • 7. Re: How to complete a manual task without enter to worklist
    905535 Newbie
    Currently Being Moderated
    Hi Naveen,

    Its just casting if context object to appropriate java class also in log its clearly mention.

    I have taken refrence from OSM devlopers guide.

    see page number 117, 'Table 5–4 Context Objects Passed To Plug-In' for more details.

    Currently I'm buzy,give me some time i will post working code.

    Regards,
    UJ
  • 8. Re: How to complete a manual task without enter to worklist
    viktor.jarolim Explorer
    Currently Being Moderated
    Hi, in order to receive the task notification context into your automator, you have to check the "Raise a Jeopardy for each branch" checkbox on the Conditions subtab of the Jeopardy tab of the Task editor in the DS.
    I already posted this here but somehow the post disappered...
    I only said "order thread based" because in the administrator that was what this was called.
    Anyway, this does it and it worked for me with an xquery automator and I posted my code in some other thread, you can look it up.

    Viktor

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points