Trying to build managed package that can analyze metadata configuration, flow specifically. Building as Lightning Component. Looking for a solution to delivery a Named Credential capable of accessing the local Salesforce instance. (Named Credential being the recommended method for API access via Lightning Component, https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/apex_api_calls.htm)


The only way I've found to get the flow information is the metadata or tooling APIs via callout. To access these from apex you must either have a remote site with a valid API-enabled session token or you can use a Named Credential for an OAuth token, or some custom/external OAuth setup.

I have built the package using Named Credential but can't find a way to deliver it cleanly. The Named Credential is for a specific URL so it wouldn't work for all customers. Seems like using a Named Credential for a somewhat dynamic endpoint just isn't going to work or would require significant install effort by the customer.


Looking to fall back to either building with Visualforce to get an API-enabled session leveraging dynamically installed Remote Site or standing up an external proxy server to relay requests which would provide a consistent URL. The latter would provide an additional hurdle when it comes to SFDC security review but would otherwise provide a method to utilize the recommended Named Credential for access.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.