Category Archives: salesforce

Using SFDX to auto login to your organizations.

SFDX provides an interesting way to login automatically to the organization you need. The only disadvantage of this approach is that you would need to reconnect each time when you sandbox organization is refreshed. To authenticate sandbox you need to … Continue reading

Posted in salesforce, sfdx | Leave a comment

Preparing package.xml for custom metadata records and sending email containing it to the current user

Preparing package.xml for custom metadata records and sending email containing it to the current user public class MD { public static String buildPackageXMLForMD(SObjectType mdt, String whereClause){ String mdtName = [ select DeveloperName FROM EntityDefinition where QualifiedAPIName = :mdt.getDescribe().getName() ].DeveloperName; List … Continue reading

Posted in salesforce | Leave a comment

Create package.xml for custom metadata records

Sometimes after creation of custom metadata records there is need to deploy them to other organization or to backup them in sandbox. Today I have written a code to build package.xml for that

Posted in salesforce, Uncategorized | Leave a comment

Debug “Validation Errors While Saving Record(s)” error message when calling Test.loadData()

Sometimes when you use Test.loadData() you might receive some confusing error message saying “Validation Errors While Saving Record(s)”, it is hard to understand what is wrong in data so it is possible to use the following code to debug the problem So … Continue reading

Posted in salesforce | Leave a comment

How to get Base URL in Salesforce from managed package context?

I have modified an answer which I have found here.

Posted in salesforce | Tagged | Leave a comment

Determine by Apex if Custom Field allows setting Field Level Security

There is FieldDefinition standard object, which is available in usual SOQL and in Tooling API. However, this object has different fields available in different ways of accessing it. It has a field IsFlsEnabled which is only available in Tooling API, … Continue reading

Posted in apex, field, salesforce | Tagged , , , , , , , , | Leave a comment