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
SFDCsachinSFDCsachin 

How to set Account fields with its related Contact fields to Email body in XML format based on ' Send Funding Email ' custom button click.

Discription :
1.       Create a custom button called Send Funding Email for Account detail page.

2.       Clicking this button should send out an email to the corresponding owner of the Account record.

3.       The email body should contain an Xml containing the following

·         Field details of all fields on the Account page layout

·         Field Details of all the Contact records associated with the Account record in consideration.

Welcomes any code sample was there to implement these.
harsha vardhanharsha vardhan
Sachin,

This is doable by using metadata API in apex. You can fetch the XML of most of the salesforce metadata elements by this. Instead the code snippet, I would like to share the GIT repo (https://github.com/financialforcedev/apex-mdapi) link.

Please go to the link and get the code from it to your dev org and try it. FYI, metadataretrieve is the page name where you can have the demo of this.

Hope it helps. Pleast post back in case of any issues.

Thanks,
Harsha