Hi All,
I have a field called 'comment' in Contract document. And once the document is moved to Executed phase all the fileds becomes non editable. And since 'Comment' is free text my user wants to do it as editable even when the document is in executed phase.The phases include
1.Draft
2.Budget Owner Approval
3.Financial Approval
4.Procurement Approval
5.Approved
6.Digital Signature
7.Executed
I tried this both in post phase script as well as pre phase script and found it's not working. Please suggest your ideas. Is there any other place I need to add code.
Postphase
if (phase.equals("Executed"))
{
logMsg.setLogMessage(" Executed START ");
Logger.info(logMsg);
/************************************************************************/
//Changes done by me
comments = doc.getExtensionField("NON_DIGSIG_COMMENT").get();
logMsg.setLogMessage(" Comments are " + comments);
Logger.info(logMsg);
IapiDocumentLockManager.unlockField(session,doc,"NON_DIGSIG_COMMENT");
//Changes ended
parent = doc.getParentIBean();
if (hasValue(parent))
{
// get associated vlv value for phase
ValueListValueIBeanHomeIfc vlvHome = IBeanHomeLocator.lookup(session, ValueListValueIBeanHomeIfc.sHOME_NAME);
if (classinfo == 1004)
{// parent is Master Agreement
vlvBean = vlvHome.findUniqueByNameType("Executed Agreement",10);
} // end if classinfo == 1004
else
{
vlvBean = vlvHome.findUniqueByNameType("Executed Agreement",1);
} // end else
if (hasValue(vlvBean))
{
vlvLocalizedRef = vlvBean.getLocalizedObjectReference();
// set parent status
parObjRef = doc.getParentIBean().getObjectReference();
parentHome = IBeanHomeLocator.lookup(session, parObjRef);
parentHome.upgradeToEdit(doc.getParentIBean());
doc.getParentIBean().setStatusRef(vlvLocalizedRef);
logMsg.setLogMessage(" Parent Status updated to " + vlvLocalizedRef.getDisplayName() + " ");
Logger.info(logMsg);
parentHome.save(doc.getParentIBean());
logMsg.setLogMessage(" Parent saved ");
Logger.info(logMsg);
}
} // end if hasValue(parent)
logMsg.setLogMessage(" Executive Summary Approval END ");
Logger.info(logMsg);
}
Prephase
if (hasValue(other_phase) && hasValue(phase) && phase.equals("Approved") && other_phase.equals("Executed"))
{
logMsg.setLogMessage("Entering comment block");
Logger.info(logMsg);
//Changes by Lakshmi
comments = doc.getExtensionField("NON_DIGSIG_COMMENT").get();
logMsg.setLogMessage(" Comments are " + comments);
Logger.info(logMsg);
IapiDocumentLockManager.unlockField(session, doc, "NON_DIGSIG_COMMENT");
if (!bypassCheck)
{
ae.chainAtEnd(doc.createApplicationException("NON_DIGSIG", "zclm.contractdocument.advancetoexecutedfromapproved"));
}
} // end if (hasValue(other_phase) && hasValue(phase) && phase.equals("Approved") && other_phase.equals("Executed"))
/******************************************************************************************************************/
//Block added my me
if (hasValue(other_phase) && hasValue(phase) && phase.equals("Digital Signature") && other_phase.equals("Executed"))
{
logMsg.setLogMessage("Entering comment block");
Logger.info(logMsg);
comments = doc.getExtensionField("NON_DIGSIG_COMMENT").get();
logMsg.setLogMessage(" Comments are " + comments);
Logger.info(logMsg);
IapiDocumentLockManager.unlockField(session, doc, "NON_DIGSIG_COMMENT");
}