Not able to pull the deadline for a task or process below is the code used.

Not able to pull the deadline for a task or process below is the code used.

ServiceContext serviceContext = ServiceLocator.getAdministratorServiceContext();
                    ProcessExecutionService pes = ServiceLocator.getProcessExecutionService(serviceContext);
LOG.debug(pes.getDeadlineForProcess(processId));
LOG.debug(pes.getDeadlineForTask(taskId));

Regards,
Sarika Bansal...

OriginalPostID-118695

OriginalPostID-118695

  Discussion posts and replies are publicly visible

  • 1. If you are executing this outside a smart service as a standalone Java snippet then you need this line at the beginning of your main method: ConfigurationLoader.initializeConfigurations();

    Here is an example that worked for me. I am using two different approaches, the both print the same (getProcessDetails().getPriority() and getPriorityOfProcess() )

    ConfigurationLoader.initializeConfigurations();
    ServiceContext sc = ServiceContextFactory.getAdministratorServiceContext();
    ProcessExecutionService pes = ServiceLocator.getProcessExecutionService(sc);

    System.out.println(pes.getProcessDetails(processId).getPriority());
    System.out.println(pes.getPriorityOfProcess(processId));

    2.If you are using this within a plug-in then it should work but I suggest you use the ProcessExecutionService injected context

  • Thanks for the response.

    I am using this code in servlet plugin and trying to get deadline. Priorty and other details I am able to get.

    Timestamp taskDeadlineTS = pes.getTaskDetails(taskId).getTaskDeadline();

    I tried as per your suggestion but still getting null return.

    2014-08-11 13:29:39,461 [http-/0.0.0.0:8080-8] ERROR com.appiancorp.common.struts.BaseAction - Error executing action: No config object with the class com.appiancorp.common.struts.BundleConfig
    java.lang.IllegalArgumentException: No config object with the class com.appiancorp.common.struts.BundleConfig
              at com.appiancorp.common.config.ConfigObjectRepository.getConfigObjectImpl(ConfigObjectRepository.java:89)
              at com.appiancorp.common.config.ConfigObjectRepository.getConfigObject(ConfigObjectRepository.java:81)
              at com.appiancorp.common.struts.BaseAction.initBundle(BaseAction.java:467)
              at com.appiancorp.common.struts.BaseAction.execute(BaseAction.java:445)
              at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
              at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
              at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
              at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
              at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)
              at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)
              at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
              at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
              at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
              at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
  • If you are using a custom servlet plug-in then ignore the line:

    ConfigurationLoader.initializeConfigurations();

    from my example, you won't need it.

    Looking at your stack trace I do not see any reference to your actual servlet plug-in, can you do the following:

    1. Stop the application server
    2. Delete the application server log (even the native ones outside Appian)
    3. Start the application server
    4. Reproduce the issue
    5. Provide the package of your servlet plug-in
    6. Attach the clean application server logs showing the stack trace that actually has references to your servlet plug-in? (all the packages in the stack trace above are Appian related I do not see any reference to your custom class)