Skip to main content
All CollectionsSystem TasksWorking with Groovy ScriptsGroovy Script Library
Groovy Script - Validate Doc Ref Uniqueness at Project Level for first revision or issue only
Groovy Script - Validate Doc Ref Uniqueness at Project Level for first revision or issue only
Updated over a week ago

Description: Sample groovy script to validate document reference uniqueness at project level for first revision or issue only

Context: Document

Remark: Accessible in 'Pre' task mode only

Script:

def execute(){

DocumentVO document = documentService.getDocumentDetails();

boolean isExistInFolder = documentService.isDocRefExist(document.getDocRef(), RevisionDetailsOption.FOLDER_LEVEL_UNIQUE); // This will check in current folder

boolean isExistInProject = false;

if(!isExistInFolder){

isExistInProject = documentService.isDocRefExist(document.getDocRef(), RevisionDetailsOption.PROJECT_LEVEL_UNIQUE); // This will exclude current folder to check

}

if(isExistInProject){

document.setResponseStatus(false);

document.setResponseMessage(document.getDocRef() + " : DocRef already exist in other folder of the project, please update it.");

}

return document;

}



Did this answer your question?