Hi @MukeshAEM,
Unfortunately this is not configurable.
In general Unique validation option is handled by com.adobe.cq.dam.cfm.impl.servlets.UniqueFieldValidatorServlet.

As it can be seen on above screen shot UniqueFieldValidatorServlet is registered on specific extension, resourceType and support GET method.
What you can do, is to create your own custom servlet with your logic that will be used instead of OOTB one. Below is sample code snippet. Make sure to set high ranking - this will guarantee your servlet will be used instead of OOTB.
@Component(service = { Servlet.class })
@SlingServletResourceTypes(
resourceTypes="dam/cfm/editor/validator/uniquefield",
methods= HttpConstants.METHOD_GET,
extensions="json")
// setting high ranking value to make sure custom servlet will be used instead of OOTB
@ServiceRanking(Integer.MAX_VALUE)
public class CustomUniqueFieldValidatorServlet extends SlingSafeMethodsServlet {
@Override
protected void doGet(final SlingHttpServletRequest req,
final SlingHttpServletResponse resp) throws ServletException, IOException {
// place for your code
}
}
Your custom servlet has to consume below 3 params:
- fragmentPath - path to currently edited content fragment
- fieldName - represents filed name in which you would like to check uniqueness
- value - represents value that will be checked if it is unique
Above params will be passed automatically to your servlet as part of GET request query string.
Please also be aware that com.adobe.cq.dam.cfm.impl.servlets.UniqueFieldValidatorServlet is not exported so you will not be able to extend this servlet directly and use code from it. You have to build entire logic by yourself.
Last but not least, if you decide to write your own servlet it has to return results in proper json format, here is an example
{
"fieldName":"title",
"fragmentPath":"/content/dam/test/my-cf-2",
"value":"Adobe",
"isValid":false,
"references":[
{
"path":"/content/dam/test/my-cf-1",
"title":"my-cf-1"
}
]
}
You can also check format of result json and request parameters using web tools in your browser.