Well, well, well, sometimes, in your application you would have to delete your records because you created one request extra, or instead of raising a request in this you raised a request under another category.
If the application is developed in Orangescape, if you delete a record, the count in the worktop will not go down, it will continue to show the count which was there before the record was deleted. So how do you delete the records, and also have proper count in worktop?!!!
Orangescape, it seems is done with the assumption that no transaction record will be deleted, but will be archived. Yeah, but in some places, it is not a requirement, you are free to delete the records. So how to do that. Let’s see how to do it.
Warning : This involves using System Models, if not done properly, could lead to problems, and i am not to be held responsible
Assumptions : I hope you know how to delete a record from inbox, because that is the method, am gonna use and am not going into the details. Also, i hope that you guys understand the relationships which exist with your models and the system models.
Ok. So, if you still reading, lets do it. before that, a little explanation, We will be dealing with one System Model => Process Instance. But because of the procedure which we are going to do, data in two system models will be affected. They are => Process Instance, Process Audit. Process Instance and Process Audit, together hold the who did what in the application, information. OK, lets get down, and get our hands dirty, shall we?
Open the Process Instance Model, Create a new action, and name it something, lets say, “Eraser”. In that action, add the delete command. Save the Model and close it.
Now, open the model where you want the delete functionality. add a new action or you can also use the existing action which you have configured to delete the record. The first command that you are going to add in this action is CallParentAction. in CallParentAction properties,
- for Parent – Model you will choose ProcessInstance(ProcessInstance).
- for ParentAction-Name you will choose the action which we created now, in this case “Eraser”
the next command that you will add is the delete command. that’s it. The action design should look like this.
Now add this action to the inbox… Now Whenever you execute this action, the Worktop count will also be recalculated to reflect the changes…..
Update: as @Vaithi_G puts it, this is good for models with straight process flow, but if there are branches you will have to include atleast two more CallParentActions for each OR or AND branches, which will make the config tedious for every branching in process, as he had suggested, you can use RCall command once instead of CallParentAction command. If you use RCall, the Parameter configuration is as follows
- Choose ProcessInstance in Model-Name list.
- for CallAction-Name enter the Action Name, again in this case “Eraser”
- for Search-Criteria enter =Criteria(ProcessInstance.InstanceId=SheetId)
Another Update: @VivekMadurai says, that in next version, the first method (using CallParentAction) itself will delete all Process Instances even though there are multiple branches. so for the sake of performance, don’t use the RCall Command method after 2 weeks.