I am trying to upload content fragment data via POST request and for each json object I have a unique 'ID' property that I want to act as a unique ID on AEM.
The problem is, when I do a mass upload split into two folders EN and FR (as the CFs are in two languages) AEM does not recognize the unique ID anymore as all the objects are split into two folders instead of one. Is there a way I can make that ID unique throughout both folders?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @parth3
refer
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-generate-dynamic-numbe...
https://experienceleague.adobe.com/en/docs/experience-manager-core-components/using/wcm-components/c...
To ensure that the unique ID remains unique across multiple folders when uploading content fragment data via a POST request, you can use a custom workflow process or a custom script to handle the uniqueness constraint.
1. Create a custom workflow process: In AEM, you can create a custom workflow process that runs after the content fragment is created or updated. This workflow process will handle the uniqueness constraint for the unique ID property.
2. Implement the uniqueness check: In the custom workflow process, you can implement the logic to check if the unique ID already exists across both folders (EN and FR). You can use the AEM Query Builder or the JCR API to query the repository and check if any content fragments with the same unique ID exist.
3. Handle the uniqueness constraint: If a content fragment with the same unique ID is found, you can handle the uniqueness constraint by either rejecting the new content fragment or modifying the unique ID to make it unique. For example, you can append a suffix or generate a new unique ID.
4. Update the content fragment: After handling the uniqueness constraint, you can update the content fragment with the modified unique ID or proceed with the creation/update process.
5. Configure the workflow: Configure the custom workflow process to be triggered after the content fragment is created or updated. You can associate the workflow process with the specific content fragment model or use other criteria to trigger the workflow.
Hi,
Now that I think of it, the unique ID by default is the "path" for any resource. Given that these two are in different paths, they are indeed different resources, although for your business logic they are two. So you should add custom logic to verify across folders if that exists based on whatever ID you need.
Hope this helps.
Hi @parth3
refer
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-generate-dynamic-numbe...
https://experienceleague.adobe.com/en/docs/experience-manager-core-components/using/wcm-components/c...
To ensure that the unique ID remains unique across multiple folders when uploading content fragment data via a POST request, you can use a custom workflow process or a custom script to handle the uniqueness constraint.
1. Create a custom workflow process: In AEM, you can create a custom workflow process that runs after the content fragment is created or updated. This workflow process will handle the uniqueness constraint for the unique ID property.
2. Implement the uniqueness check: In the custom workflow process, you can implement the logic to check if the unique ID already exists across both folders (EN and FR). You can use the AEM Query Builder or the JCR API to query the repository and check if any content fragments with the same unique ID exist.
3. Handle the uniqueness constraint: If a content fragment with the same unique ID is found, you can handle the uniqueness constraint by either rejecting the new content fragment or modifying the unique ID to make it unique. For example, you can append a suffix or generate a new unique ID.
4. Update the content fragment: After handling the uniqueness constraint, you can update the content fragment with the modified unique ID or proceed with the creation/update process.
5. Configure the workflow: Configure the custom workflow process to be triggered after the content fragment is created or updated. You can associate the workflow process with the specific content fragment model or use other criteria to trigger the workflow.
Views
Likes
Replies