cancel
Showing results for 
Search instead for 
Did you mean: 

Lock Fields When Phase Changed

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Vincent,

Once the Contract is locked, you can write a new toolbar script to unlock the contracts in Locked Phase and you can move the phase to the previous phase and re-trigger the approval flow.

Attached screen shot

Thanks

Vimal

Former Member
0 Kudos

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

Former Member
0 Kudos

Vimal,

Thank you for the suggestion. This is a option we will investigate. I was hoping to mimic the functionality that the system does "out of the box" when it goes into Executed phase, but it appears that is not possible.

Thanks,

VL

Former Member
0 Kudos

Kumud,

Thank you for your reply and scripting suggestion! I will investigate this as well to see if it provides us with the desired functionality.

VL

Answers (0)