Delete Associated Workflows after document has been deleted - alfresco

on delete of a document, by default the workflow is left in a hanging state and the reference of the document gets removed from the workflow side (bpm_package).
I want to change it as follows: if a document has been deleted in the repository then all the workflow that are associated with it should get deleted (each workflow package will always have a single document)
I tried to implement this by using rule/action (items are deleted or leave this folder) - was able to find workflows in js and cancel them, but it does not delete the document nor the workflow. on checking the XHR request i was able to find out that a concurrency exception occurs between the action and onDelete policy.
how do i delete/cancel/close the associated workflows of a document
i'm using alfresco community 5.2

You need to create Behavior/Policie to achieve this task.
http://docs.alfresco.com/6.0/references/dev-extension-points-behaviors.html
You can use beforeDeleteNode/onDeleteNode behaviour and write logic here to delete workflow.

Related

Does delete document firestore function throws not found exception? (flutter)

I am trying to understand if delete document function in firestore(flutter) return any information about the deletion like if the item is not been found? and the deletion hasn't come through?
There is no precondition that requires the file to exist before it can be deleted. If the file didn't exist in the first place, or was deleted already, Firestore considers the operation successful.
If you want to handle the case where the file doesn't exist different in your application, you should use a transaction to delete the file and check for its existence inside the transaction handler.

Meteor server response slow when importing collection

I have a MongoDB collection Foods in my Meteor app with about 8000 entries with almost 1000 fields each.
For some reason, since I included it, the response time when I call a server method from the client is very slow (seconds). For debugging, I've been removing things one by one. Now, I don't use the collection in any of the functions involved (I've even replaced the server method with just a console.log), and yet if I add the line import { Foods } from '../imports/collections.js'; to the server, the response is slow, and if I don't it is fast.
Does anyone have any idea why this could be?
Note: OP has already answered his question satisfactory. However, the following information should be pointed out, especially for those who face similar issues in context of controlling Meteor's autopublish behavior.
As long as autopublish exists in your packages list, each collection publishes to the client at the very moment, your Mongo.Collection is created.
See this code of the Mongo.Collection constructor.
Autopublish is then triggered, even just by importing your file that contains a Mongo.Collection constructor to be called (which is very likely your case).
However, you dont need to remove the autopublish package if you only want this one collection to prevent auto publishing.
Your Mongo.Collection constructor accepts as second parameter an object with options. To prevent auto publish only for this collection (while having autopublish active) you can add the following option:
{
_preventAutopublish: true,
// ... other options if desired
}
An example for your given Foods collection could be
export const Foods = new Mongo.Collection('foods', {_preventAutopublish: true});
Although the option is not documented, it works and comes in very handy when prototyping.
However, keep in mind that autopublish is not secure and should never be present in a release that is expected to be deployed on a server.
So the answer was easy.
As said in the Meteor docs,
By default, Meteor automatically publishes every document in your collection to each connected client. To turn this behavior off, remove the autopublish package
So, simply by importing the collection, Meteor interprets that you want to publish it all, and that is what was making it slow, even if I wasn't explicitly using it.

Is it possible to get a list of workflows of current user in Alfresco

How to get a list of active workflows/tasks of current user in Alfresco by JavaScript API ?
It is require to create a rule which will write active tasks to the some file and hang/attach this rule to/on a folder.
Yes it is possible to get the list of workflows.
You can do that with the following api.
GET /alfresco/service/api/task-instances?authority={authority?}&state={state?}&priority={priority?}&pooledTasks={pooledTasks?}&dueBefore={dueBefore?}&dueAfter={dueAfter?}&properties={properties?}&maxItems={maxItems?}&skipCount={skipCount?}&exclude={exclude?}
GET /alfresco/service/api/workflow-instances/{workflow_instance_id}/task-instances?authority={authority?}&state={state?}&priority={priority?}&dueBefore={isoDate?}&dueAfter={isoDate?}&properties={prop1, prop2, prop3...?}&maxItems={maxItems?}&skipCount={skipCount?}&exclude={exclude?}
Note: You can set your own parameters according to your requirements in the request
See the documentation.

is Workflow Management right required to create SG with Workflow Process defined?

We are noticing that if a user without Workflow Management rights on a Publication tries to create a Structure Group and sets the "Associated Page Process" set on the Workflow tab, they get a permission error. If the workflow setting is removed, the user can save without issue.
I assume this is by design in the product, right? I wanted to verify that we weren't hitting something in our custom code. If it matters, here's what's logged:
Unable to save Structure Group (tcm:0-0-0). You do not have permission to perform this action. Error Code: 0x80040242 (-2147220926) Call stack: Tridion.ContentManager.Security.AuthorizationManager.AssertAccess(IdentifiableObjectData,Permissions,Rights) Tridion.ContentManager.CommunicationManagement.StructureGroup.OnSaving(SaveEventArgs) Tridion.ContentManager.IdentifiableObject.Save(SaveEventArgs) Tridion.ContentManager.IdentifiableObject.Save() Tridion.ContentManager.BLFacade.ContentManagement.RepositoryLocalObjectFacade.Create(UserContext,String) XMLState.Save StructureGroup.Save
thanks,
~Warner
Yes, to assign a Workflow Process Definition to an item (Schema or SG), you need Workflow Management rights.

Windows Workflow - Creating a reusable task list (bookmarks?)

I'm looking at migrating business processes into Windows Workflow, the client app will be ASP/MVC and the workflows are likely to be hosted via IIS.
I want to create a common 'simple task' activity which can be used across multiple workflows. Activity properties would look something like this:
Related customer
Assigned agent
Prompt ("Please review PO #12345")
Text for 'true' button ("Accept")
Text for 'false' button ("Reject")
Variable to store result in
Once the workflow hits this activity a task should be put into a db table. The web app will query the table and show the agent a list of tasks they need to complete. Once they hit accept / reject the workflow needs to resume.
It's the last bit that I'm stuck on. What do I need to store in the DB table to resume a workflow? Given that the tasks table will be used by multiple workflows how work I instantiate the workflow to resume it? I've looked at bookmarks but they assume that you know the type of workflow that you're resuming. Do I need to use reflection or is there a method in WF where I can pass a workflow id and it will instantiate it?
You can use workflow service and control its via ControlEndPoint.
For more info about controlendpoint you can refer at
http://msdn.microsoft.com/en-us/library/ee358723.aspx

Resources