Handle DuplicateChildNodeNameException.

cancel
Showing results for 
Search instead for 
Did you mean: 
supriya_verma
Member II

Handle DuplicateChildNodeNameException.

Requirement is to handle DuplicateChildNodeNameException. In case of this scenario, we need to give an option to the user whether s/he wants to Override the existing document or want to specify a new name. A pop up should display with errormessage as "Node with same name already exist. Select Yes if you want to override the existing node OR selet No for specifying a new name". In case user selects Yes, the existing node should get replaced with new node and in case of No, we should give the popup to user to specify a new name.

2 Replies
krutik_jayswal
Senior Member II

Re: Handle DuplicateChildNodeNameException.

DuplicateChildNodeNameException will occur in case of new node, move node or copy node and there can be other scenarios as well, you need to add in your requirement exactly where you would like to ad this.

You need to create 2 webscript,first one will identify whether there is any node with same name exist or not, if yes than you need to give pop to user and based on response of user you can perform the operation.

For more details on webscript you can use below links.

https://ecmarchitect.com/alfresco-developer-series-tutorials/webscripts/tutorial/tutorial.html

http://www.krutikjayswal.com/2016/10/alfresco-webscript-spring-webscript.html

supriya_verma
Member II

Re: Handle DuplicateChildNodeNameException.

Hello Krutik,

Thank you so much for your reply..

The error I am getting while saving the document with same name. This error I am getting from form.post.json.js. Calling it from formSubmissionPayloadMixin by passing "api/{itemType}/{itemKind}/formprocessor in the url property. So when there is an Duplicate.. exception , Notification pop displays with "operation Failed" message. Instead of default notification pop up , I need to show the custom pop up with the message described above.

This all I need to do on faceted-search.get.js page.I am trying to call my custom popup on "failureCallback" and also tried "onFailedSubmission" property of formSubmissionPayloadMixin. But these methods are not getting called.Whereas able to customize the message displaying on default Notification pop up by "failureMessage" property.

My main concern is I am not able to show the pop up on content creation failure.

Could you please suggest me how to achieve the same .

Thanks in advance.