1

We're moving our org metadata management to SFDX project. Ideally, none of the metadata files supposed to be edited by Salseforce UI.

As an example, we are using Javascript Buttons, and "url" parameter is retrieved in xml following way:

{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}

While in salesforce UI those two lines looks like this:

{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}

I get it, that in XML you must escape characters like ', ", <, >, but it is making harder to manage and write the actual code.

Same goes with Validation Rules, Workflows, EmailTemplates and other metadata.

Is there a conventional practice for editing such metadata, besides copy-pasting it using Salesforce UI? Maybe some extensions for vscode and/or salesforce CLI?

I've also asked this question here https://github.com/forcedotcom/salesforcedx-vscode/issues/2233 but no response yet

1

Many of the metadata types that are not code-based are either undocumented or difficult to work with. For this reason, it is recommended that you simply use a Scratch Org. You can create a Scratch Org, use force:source:push to deploy your current code to this org, edit your metadata in the UI (e.g. your validation rule), then force:source:pull to get the changes back out in to your metadata folders. This process is mostly automatic, as the force:source:pull command is able to check for all changes made in the UI through Scratch Orgs' ability to source track metadata changes in the UI.

However, in some cases, such as validation rules, it would be feasible to write a VS Code extension to translate the characters back and forth, write a custom UI editor, etc. This is really outside the scope of this site, but I did want to bring up the fact that you could make an extension and even publish it to share with others if you wanted to.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.