on 01-17-2013 7:01 PM
Sourcing Gurus,
We have added a additional phase at the end of our contract workflow (after Executed Phase) and have the desire to have the system behave similarly to the way the Executed Phase behaves out of the box (i.e. locks all fields on Contract Document Tab and allows users to change back to previously phase(s) if needed).
We tried to accomplish this via a script by using lock field method in class IapiDocumentLockManager (IapiDocumentLockManager.lockField) without any luck.We are able to lock the entire document via IapiDocumentLockManager.lockDocument but this is not the preferred solution asthe document can no longer be moved to a previous phase once locked.
Any suggests on utilizing the system standard behavior when in Executed phase or is the best solution to continue to debug our issues with the lock field method.
Thanks in advance!
Vincent
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
For locking as you have told you are successful to lock the document using documentlockmanager.lockDocument()...
you can try this :
ContractDocumentIBeanIfc contractDoc=null;
int objectId= doc.getDocTypeReference().getObjectId();
ContractDocumentIBeanHomeIfc contractDocHome=(ContractDocumentIBeanHomeIfc)IBeanHomeLocator.lookup(session,ContractDocumentIBeanHomeIfc.sHOME_NAME);
String wC="OBJECTID= "+"'"+objectId+"'";
List contractDocList = contractDocHome.findWhere(wC );
if( contractDocList.size() > 0 )
{
contractDoc= (ContractDocumentIBeanIfc)contractDocList.get(0);
}
String docPhase= contractDoc.getCurrentPhase().getDisplayName(session);
if("XXXXXX".equals(docPhase))
{
contractDocHome.upgradeToEdit(contractDoc);
IapiDocumentLockManager.lockDocument(session,contractDoc);
contractDocHome.save(contractDoc);
contractDocHome.downgradeToView(contractDoc);
}
//write this script in prephase to unlock the script...
if("EXECUTED".equals(docPhase))
{
contractDocHome.upgradeToEdit(contractDoc);
IapiDocumentLockManager.unlockDocument(session, contractDoc)
contractDocHome.save(contractDoc);
contractDocHome.downgradeToView(contractDoc);
}
Hope this would help you
Kumud
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.