You are here:
IsContractDocumentEditableInterface
Determine whether a contract document can be changed.
Type
Loosely typed
Triggered When
The IsContractDocumentEditableInterface is triggered when the system renders the contract document user interface. If the contract is editable, the contract document user interface displays the Template picklist and the Attach Template, Remove Template, and Customize buttons. If a contract is not editable, the contract document user interface is read-only.
Called In
The ContractDocumentVersionSection component uses the ContractDocumentDisplayController, which calls the IsContractDocumentEditableInterface.
Signature
Access |
Signature |
|---|---|
global |
|
Default Implementation
The DefaultIsContractDocumentEditableImplDefaultIsContractDocumentEditableImplimplementation determines if a contract document can be changed or not, including the permission to switch the template, customize a document, or remove a template. When a contract status is draft and the contract document status is active, you can switch the template, remove the template, or customize the document.
Other Implementations
None
Input Parameters
methodName
Required
Type: String
The method to execute, for example, isContractDocumentEditable
contractVersionId
Provided
Type: Id
The contract version ID, for example:
Id contractVersionId = (Id) inputMap.get('contractVersionId');
Output Parameters
Boolean
Required
Whether the contract is editable, for example:
outMap.put('editable', true); or outMap.put('editable', false);
Sample Implementation
global with sharing class CustomContractDocumentEditableImpl implements vlocity_cmt.VlocityOpenInterface
{
public Boolean invokeMethod(string methodName, Map<string, object> inputMap, Map<string, object> outMap, Map<string, object> options)
{
Boolean success = true;
if(methodName == 'isContractDocumentEditable')
{
getEditable(inputMap, outMap, options);
}
return success;
}
private void getEditable(Map<string, object> inputMap, Map<string, object> outMap, Map<string, object> options)
{
string nameSpaceprefix = ApplicationUtilities.getNameSpacePrefix();
Id contractVersionId = (Id)inputMap.get('contractVersionId');
List<vlocity_cmt__ContractVersion__c> contractVersions = [SELECT
Id,
vlocity_cmt__Status__c,
vlocity_cmt__ContractStatus__c
FROM
vlocity_cmt__ContractVersion__c
WHERE
Id = : contractVersionId];
if(contractVersions != null && contractVersions.size() == 1)
{
if(contractVersions[0].vlocity_cmt__Status_c == 'Active' && contractVersions[0].vlocity_cmt__ContractStatus_c == 'Draft')
{
outMap.put('editable', true);
}
else
{
outMap.put('editable', false);
}
}
}
}
