on 01-08-2013 4:20 AM
Hi,
We are currently working on an enhancement to the Workflow framework in CLM. Business wants to auto-route the contract documents from one approval phase to another instead of having it do it manually.
There are 2 parts to this development – one is to auto-route contract document from one phase to another (which we have accomplished) while ensuring the contract document remains locked down when any of the approval teams are reviewing the contract. The issue that we are facing is with this locking out feature. Whilst through the code we have successfully achieved contract document movement automatically, the locking down is not happening.
Is locking out a separate feature which cannot happen if system automatically routes from one phase to another? Meaning does locking down only happen when performed manually?
Your help is much appreciated.
Thanks,
Vikram
Hi Vikram,
Changing phase of a contract document using the changePhase method on the IBeanHome class should behave the same way as phase change done manually via the UI. So if I understand correctly, in your system if the user does the same phase change manually it works, meaning the contract document is locked and workflow is triggered. However, if the phase change is done via a script, the document is unlocked even though it is a workflow phase and workflow is not triggered. Is my understanding correct?
Also, it will help if you could shed some light on the script that does the phase change. How is it implemented? What is the target? Is it a toolbar script? Is the current phase also a workflow phase?
Regards,
Vikram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vikram,
Yes, your understanding is correct.
Yes, we are achieving the phase change via a post script on the workflow definition and all the phases used are workflow phase.
Here is how the script looks like-
home = doc.getIBeanHomeIfc();
home.upgradeToEdit(doc);
home.changePhase(doc,"Obtaining Tax Approval");
With this the Contract Document moves on to the next phase successfully, but it remains in an unlocked state.
We have also tried IapiDocumentLockManager.lockDocument(session,doc);
Here it gets locked, but only for a particular user contrary to a system lock which is expected.
Please advise if we should try a different approach?
Thanks,
Vikram
Hi Vikram,
So it sounds like you are trying to move from one workflow phase to another workflow phase. Please note, consecutive workflow phases is currently not supported. I have seen consecutive workflow phases attempted before but have run into issues similar to what you are seeing. Our recommendation is to have a “landing” phase (a non workflow phase) before entering the next workflow phase.
In your case since you want to do this programmatically it gets tricky. You may want to play around with it a little bit. In your post script you could move it to the “landing” phase and then have a phase change target script on the “landing” phase that would then move it to the workflow phase. Note, this is all theoretical. I’ve not attempted it myself and no guarantees that this would work but may be worth trying. If it works, thorough testing should be done to make sure there is no undesired side effects. Sorry, I don't have more concrete recommendation.
Regards,
Vikram
Hi Vikram,
As per your suggestion we had included a "landing phase" in between two workflow phases but, phase change is only happening from one workflow phase to that landing phase and not further from landing phase to another workflow phase.
//Scripting goes like this
//already in workflow phase
home = doc.getIBeanHomeIfc();
home.upgradeToEdit(doc);
home.changePhase(doc,"Legal Review"); //landing phase
home.save(doc);
if(currentPhase.equals("Legal Review")){
home = doc.getIBeanHomeIfc();
home.upgradeToEdit(doc);
home.changePhase(doc,"Obtaining Risk Mgmt. Approval- General"); //workflow phase
home.save(doc);
}
Please advise on this.
Also, is there a way to achieve a system lock via code on a particular contract document?
Hi Murali,
To unlock the script you can use the below sample code. You can add all the phases in a array and lock the phase.
Thank You
if (currentPhase != null) {
PhaseLockTypes = new String[] {"Phase 1","Phase 2","Phase 3","Phase 4"};
for(int i=0;i<PhaseLockTypes.length;i++) {
if((currentPhase.equals(PhaseLockTypes[i]))){
IapiDocumentLockManager.lockDocument(session,doc);
}
}
}
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.