on 2016 Apr 10 9:47 AM
Hi Guys,
i have a problem in which i have to reopen the Closed Master Agreement:
I have created a Toolbar Script which helped me to activate the Master Agreement but the Status of the Master Agreement was still "Closed".
Guys could any one help me a way through in which i can update the Status of the Master Agreement in the ToolBar Script Itself.
Code used is below:
MA_DOCUMENT_NUMBER="EXPLICIT MA NUMBER which we have re open"
ContractIBeanHomeIfc contractHome = (ContractIBeanHomeIfc) IBeanHomeLocator.lookup(session, ContractIBeanHomeIfc.sHOME_NAME);
ContractIBeanIfc contract = (ContractIBeanIfc) contractHome.findByUniqueDocName(MA_DOCUMENT_NUMBER);
if (contract.isClosed())
{
contractHome.upgradeToEdit(contract);
contract.setIsInactive(Boolean.valueOf(false));
contract.getFieldMetadata("CLOSED_AT").set(contract, null);
contract.getFieldMetadata("CLOSED_BY_USER").set(contract, null);
contractHome.save(contract);
}
Regards
Tarun rawat
Hi Tarun,
If I remember correctly, when closing, the system also marks the MA as 'cancelled'. You should also check if isCancelled() is true and to a similar update.
Also check by refreshing the document (if you are calling the script from the same MA you'll need to refresh to get the new values from DB).
PS: Your existing code should be OK, I implemented the same thing for a client (plus the CANCEL part) and it was working fine.
Bogdan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.