function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
visualforce_devvisualforce_dev 

Creation of page layouts using Java

Anybody pls help me out by tracing the error in this code...

LayoutItem[] MyLayout=new LayoutItem[100]; LayoutItem item1=new LayoutItem(); item1.setField(nf1.getFullName()); MyLayout[0]=item1; LayoutColumn[] lc= new LayoutColumn[5]; LayoutColumn lc1= new LayoutColumn(); lc1.setLayoutItems(MyLayout); lc[0]=lc1; LayoutSection[] ls=new LayoutSection[5]; LayoutSection ls1=new LayoutSection(); ls1.setLayoutColumns(lc); LayoutSectionStyle lstyle; ls1.setStyle(LayoutSectionStyle.OneColumn); ls[0]=ls1; Layout MyLayout1=new Layout(); MyLayout1.setFullName(co.getFullName()+"-Mylayout"); MyLayout1.setLayoutSections(ls); try { AsyncResult[] avl = msfdc.create(new Metadata[]{MyLayout1}); if(avl.length>0) { System.out.println("page layout Created Successfully"); } } catch(Exception e) {System.out.println("page layout Error"+e);}

 

 

where 'co' is the custom object created and 'nf1' is the custom field .I tried '.' for setname function but its not working.