+1 vote
1 view
in Salesforce by (11.3k points)

I want to create a new Visual force page with visual force markup code

<apex:page >

<apex:iframe src="**ReportID**?isdtp=nv" scrolling="true" id="theIframe"/>

</apex:page>

Where the report will be already created programmatically and the report id from that URL is given as a parameter.

Please post the details and snippets if possible, I am a very newbie to salesforce development.

Thanks In advance.

1 Answer

+1 vote
by (28.6k points)

The following code will help you create a visual force page:

byte[] ContentBytes;

String Content = "<apex:page >//PageContent In Apex Code//</apex:page>";

ApexCode= Content.getBytes("UTF-8");

double version = 15.00;

com.sforce.soap.metadata.ApexPage pag = new com.sforce.soap.metadata.ApexPage();

pag.setFullName("Name");

pag.setDescription("Description");

pag.setLabel("Label");

pag.setAvailableInTouch(true);

pag.setApiVersion(version);

pag.setContent(ApexCode);

pag.setConfirmationTokenRequired(false);

Metadataconnection.create(new Apexpage[](pag);

And check the status by Checkstatus() method of metadata API.

...