Hi Mishra, I don't think using the workflow is the right way to go here. Since you already know you will approve the activation, why not activate directly, without using the workflow?
Take a look at the class " info.magnolia.module.admininterface.commands.ActivationCommand". I would try using the command directly, rather than via the workflow. Regards from Vienna, Richard -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]] Im Auftrag von sonali mishra (via Magnolia Forums) Gesendet: Mittwoch, 01. August 2012 14:42 An: Magnolia User List Betreff: [magnolia-user] Re: Help: Want to activate page with my own template automatically with code once it got created in website (using code) Currently trying: I am creating a page with the code below: session = MgnlContext.getJCRSession(RepositoryConstants.WEBSITE); Node c = session.getNode("/SampleSite/Articles"); Node newPage = c.addNode(articleName, MgnlNodeType.NT_PAGE); //setting the template & components details… session.save(); It is successfully creating a page under SampleSite/Articles in website section of magnolia After that I am trying auto publish as below Preparing the launch item: LaunchItem li = new LaunchItem(); //set the article uuid, path, username to the launchItem li prepareLaunchItem(newPage, li, "/SampleSite/Articles/"+ articleName); Sending the launchItem to inbox: WorkflowUtil.launchFlow(li, WorkflowConstants.DEFAULT_ACTIVATION_WORKFLOW); Till this also it is working fine. The item is going to inbox after getting created. Now I have put a sleep of 20 seconds Thread.sleep(20 * 1000); After the sleep time I am trying to activate it using the following piece of code: Approach -1 Trying to get the launchItem list in inbox (which is under superuser) List<InFlowWorkItem> inFlowWorkItems = WorkflowUtil.getWorkItems("superuser"); Trying to activate it using the code below WorkflowUtil.proceed(InFlowWorkItem); Problem : The List<InFlowWorkItem> is null. Though the workitem is send to inbox but it’s not activating it (meaning not sending it to public instance) Approach -2 Trying to get the launchitem using the method below WorkflowUtil.getWorkItem("id"); This id which we are passing is “FlowExpressionId”. Problem: I have no clue from where I will get this id. So not able to proceed for activation -- Context is everything: http://forum.magnolia-cms.com/forum/thread.html?threadId=3c519731-aa88-43b6-9e16-1982a47b664f ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <[email protected]> ---------------------------------------------------------------- ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <[email protected]> ----------------------------------------------------------------
