Expand my Community achievements bar.

Who Me Too'd this topic


Level 2

I am trying to run the following code to create content fragments programmatically. The code runs fine but there is no content fragment created in the DAM.


I am able to create the content fragments manually but not programmatically.


//Does not create a content fragment
Resource templateRes = resourceResolver.getResource("/conf/<projectname>/settings/dam/cfm/models/custom-model");
fragment = templateRes.adaptTo(FragmentTemplate.class).createFragment(parentFolder, "custom-name", "Custom Title");

// Asset gets created successfully.
AssetManager assetMgr = resourceResolver.adaptTo(AssetManager.class);
Resource resource = resourceResolver.getResource(parentFolder.getPath()+"/"+"test.jpeg");
Asset asset = assetMgr.createAsset(parentFolder.getPath()+"/"+"test.jpeg", null, "image/jpeg", true);


 Any help is appreciated.



Nikunj Jariwala


Topics help categorize Community content and increase your ability to discover relevant content.

Who Me Too'd this topic