Liferay 7.2 - What is classNameId in DDMStructureLocalServiceUtil

Fabio Carvalho, modified 6 Years ago. Junior Member Posts: 81 Join Date: 6/25/19 Recent Posts
Hi,

I am trying to add DDMStructures programmatically. For this I am using the following method:
DDMStructureLocalServiceUtil.addStructure(
    theme.getUserId(), 
    theme.getScopeGroupId(), 
    DDMStructureConstants.DEFAULT_PARENT_STRUCTURE_ID, 
    classNameId, //What is this?
    null, 
    nameMap, 
    descriptionMap, 
    ddmForm, 
    ddmFormLayout, 
    StorageType.JSON.getValue(), 
    DDMStructureConstants.TYPE_DEFAULT,
    context
);

But I have no clue on how to get the classNameId. What is supossed to pass there? Is this some constant that I can't find?
thumbnail
Mohammed Yasin, modified 6 Years ago. Liferay Master Posts: 593 Join Date: 8/8/14 Recent Posts
Hi, 
You can pass classnameId of those class for which you want to add ddmstructure ,
Ex
If you want to add DDMStructure for JournalAritcle then you will pass classnameId of Journal article
If you want to add DDMStructure for DDMFormInstance  then you can pass classnameId of DDMFormInstance
Now to get classnameId you can either use      
  ClassNameLocalServiceUtil.getClassNameId(DDMFormInstance.class)    or     
        PortalUtil.getClassNameId(DDMFormInstance.class);
You can refer this for more understanding
Fabio Carvalho, modified 6 Years ago. Junior Member Posts: 81 Join Date: 6/25/19 Recent Posts
Thanks Mohammed,

I was trying to add a structure to DDMRecordSet, so I ended up with:
ClassNameLocalServiceUtil.getClassNameId(DDLRecordSet.class)