What’s new with the Apex Metadata API for Force.com

Apex metadata API

Salesforce has paid heed to a long-standing demand of its developer community and partners, and has rolled out Apex Metadata API for Force.com.

The new Apex Metadata API makes it possible to build tools to manage the metadata model, rather than the data itself. Some of the handy functions possible using the new Apex Metadata API are:

  • Accessing page layouts and records of custom metadata types, and retrieving the metadata synchronously
  • Creating and updating metadata using asynchronous deploy
  • Offering “ApexCertification” for installed apps, to allow an Apex metadata deploy, improving reliability and credibility of the app.
  • Tracking the namespace that initiated a deploy in the setup audit trail.

Application of the Apex Metadata API 

Apex Metadata API helps developers run automation scripts to build self-configuring applications, custom set-up user interfaces, and upgrade scripts on which apps run.

Independent software vendors (ISVs) find Apex Metadata API handy to offer unique setup experiences for their applications. Previously, such a feature required extensive configuration changes, done manually in the Salesforce setup. Making such changes is complex and daunting for an ISV, with adding even a single component involving creating multiple customizations to Salesforce, topped up by the near impossibility to logically map the places where changes are to be made. 

The new tool not only spares developers a lot of manual work and accompanying hassles, but also offer admins a neat and intuitive UI for the setup task. The setup wizards created using Apex Metadata API guides admins through the process or flow which is logically consistent with what the admins intend to build or customize. For example, adding a custom field to an object in Salesforce entails going to setup, finding the required object in the Object Manager, navigating to Fields & Relationships, clicking on “New,” and following the rest of the steps in the wizard. The configuration changes, hitherto done manually in Salesforce Setup, is now done seamlessly in the backend by the Metadata API.

Another key use of Metadata API is to automate some of the inevitable customization that follows after the app is installed. Post-install scripts generated using Apex Metadata API automates the required configuration changes. The script looks at the configuration of the subscriber org and configures the installed package based on how the org is set up. For example, if a package upgrade involves a new field, the Apex Metadata API adds such a field to page layouts. Both the custom setup UI and automation of post-install scripts drastically reduces and simplifies the admins work.

Related: Salesforce Einstein Analytics: Becoming a data scientist was never this easy

Enterprises may use Apex Metadata API in a development environment to manage customization, by retrieving, deploying, creating, and/or updating customization information, such as custom object definitions and page layouts. The most common use here is to migrate changes from a sandbox or testing org to the production environment. Salesforce has exposed the underlying calls of Metadata API, making it possible for enterprises to use it directly, and build own client applications.

Enterprises could also leverage the Apex Metadata’s automation capabilities to build tools that automatically make config changes when changes are made elsewhere. For instance, when the admin makes a manual change, running a simple wizard using Apex Metadata could trigger updates to other metadata automatically.

How does the new tool benefit? 

Apex Metadata API offers a host of benefits across-the-board, helping Independent Software Vendors (ISVs), app developers, enterprises, and other stakeholders. Building custom setup wizards, self-configuring apps, and automating post-install scripts to update metadata simplifies the task of app configuration, accelerates the process, and unlocks new business opportunities. Manual set-up can always result in errors. Automated custom set-up improves accuracy, and eliminates some setup steps.

For admins and developers, there is work enrichment and improved productivity. Admins may change the configuration on the fly, without waiting for professional expertise. Even end users get a better and faster setup experience, allowing them to install apps easily, without technical know-how.

The ability to update protected metadata in the app allow businesses to mask more of the configuration and thereby protect intellectual property.

Featured whitepaper

Understanding Salesforce Wave Analytics Cloud

Limitations of Apex Metadata API

Apex Metadata API for Force.com is still in its first release, and like all first releases, has some limitations. The version launched now is a limited version, inaugural release.

At present, support is limited to only page layouts and record of custom metadata types. Again, in these meta-data types, only “Read,” “create,” and “update” are supported, and “delete” is not supported. Another notable absence is a deploy status API, although the callback upon completion of deploy offers an effective workaround.  Another limitation is the Apex Metadata API using an asynchronous deploy, which is not compatible with Apex’s synchronous tests.

Related: The top 6 enterprise advantages of Salesforce Wave Analytics

However, Salesforce is at work to overcome these limitations. The Apex Metadata API group in the Success Community is already working to increase the number of metadata types, and it is only a matter of days before the scope of this handy and intuitive tool is expanded considerably. A Trailhead module with a lot more detail on this powerful new capability is set to launch any time now.

Such temporary limitations notwithstanding, it has already received widespread acceptance. The tremendous popularity and acceptance, in fact, underscores the pressing need for this tool. The popularity of the tool may be gauged by Andy Fawcett’s Idea for this feature receiving over 7,000 points in IdeaExchange, and the Apex Metadata API wrapper created by Andy standing out among the 800+ Apex language repos in GitHub, with three times the forks and more stars than the next repo.


Does the Journey Builder Enrich Salesforce Marketing Cloud?

Impact of LockerService on Salesforce Lightning Components

How Salesforce CPQ model enhances brand experience and increases sales

Author : Nayab Naseer Date : 04 Aug 2017