How can we stop Un-Publish in event system ?
My Requirement is to stop unpublishing in Event System and put the item into bundle X and start a WorkFlow Y on this bundle .
I am able to achieve adding item into bundle and able to trigger workflow also on this. What is happening is my item got unpublished all the time and Workflow Y also trigger all the time.
I want to stop the unpublihsing and want to start WorkFlow.
I have tried this till now
Bundle bundle = (Bundle)item.Session.GetObject("tcm:26-172-8192");
bundle.AddItem(item);
bundle.Save();
StartWorkflowInstruction instruction = new StartWorkflowInstruction(item.Session);
instruction.Subjects.Add(bundle);
ProcessInstance result = bundle.ContextRepository.StartWorkflow(instruction);
SQL Error on mPublishTransaction.Delete();
StackTrace Information Details:
at Tridion.ContentManager.Data.AdoNet.Sql.SqlDatabaseUtilities.Execute(StoredProcedureInvocation storedProcedureInvocation)
at Tridion.ContentManager.Data.AdoNet.IdentifiableObjectDataMapper.Read(TcmUri id, StoredProcedureInvocation spInvocation)
at Tridion.ContentManager.Data.AdoNet.IdentifiableObjectDataMapper.Tridion.ContentManager.Data.IIdentifiableObjectDataMapper.Read(TcmUri id)
at Tridion.ContentManager.Session.GetDataObject(TcmUri id)
at Tridion.ContentManager.IdentifiableObject.Load(LoadFlags flags, Boolean forceReload)
at Tridion.ContentManager.IdentifiableObject.Reload()
at Tridion.ContentManager.IdentifiableObject.get_Description()
at MetLife.ADD.Tridion.Eventing.PageUnPublishWorkFlow.AddItemToUnPublishBundle(RepositoryLocalObject item, UnPublishEventArgs args)
at MetLife.ADD.Tridion.Eventing.PageUnPublishWorkFlow.PageUnPublishWorkFlowChange(Page subject, UnPublishEventArgs args, EventPhases phase)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at Tridion.ContentManager.Extensibility.EventSubscription.<DeliverEvent>b__0(AsynchronousEventWorkItem workItem)
at Tridion.ContentManager.StaThreadPool`1.StaThread.DoWork()