AnsweredAssumed Answered

How to get current site details in alfresco repository

Question asked by ratik.singhal on Sep 21, 2018
Latest reply on Sep 25, 2018 by jpotts

Hello,

 

In datalist(custom), I am submitting a form (creating 'NewItem' ) and validating that it should not allow saving duplicate based on a property(e.g BatchName).

 

I know that it's handled by http://localhost:8080/share/proxy/alfresco/api/type/my:prop/formprocessor. That's why I am overriding form.post.json.js

 

In form.post.json.js, based on itemId I am doing validation. 

if(itemId == "my:prop"){
var luceneQuery = "PATH:\"/app:company_home/st:sites/cm:"+siteId+"//*\" AND TYPE:\"my:prop\" AND @my\\:batchName:\""+selectedValue+"\"";

var result = search.luceneSearch(luceneQuery);
logger.system.out("@ luceneQuery : " + luceneQuery);
logger.system.out("@ Result length: " + result.length);
if(result.length >0){
status.setCode(409, "already exist..");
return;
}
}
persistedObject = formService.saveForm(itemKind, itemId, repoFormData);

 

But my prob is that I am not able to get the site value here. and I want to check duplicate in the current site. 

 

Anyway so that I can get the site here ???

 

'NewItem' of toolbar.js and toolBar.get.html.ftl the method is already overwritten in another datalist.  Hope I cannot override toolbar multiple times. 

Outcomes