Questions tagged [bestpractice]
Referring to the use of recognized community and platform best practices. May relate to all areas of lifecycle and all development and administration activities.
425 questions
0 votes
0 answers
57 views
Impact of Special Characters in Composite Keys for Custom Metadata
I have a custom metadata table that stores different combinations of field values, including picklist values that contain special characters like quotes (", ') and semicolons (;). Current Setup ...
0 votes
1 answer
196 views
Best practices for building a Rest Resource class
I'm looking for a general approach or best practices for building a Rest Resource class/classes, so it could be easily expandable in the future. Or maybe you have an example of something a bit more ...
0 votes
0 answers
48 views
B2B Commerce: Best Practice for product visibility
we have customers that own one or more assets. Each asset is a large machine that is individually configured. In our B2B commerce shop, customers should be able to order spare parts and consumption ...
9 votes
1 answer
2k views
Agentforce - Scoping and instructing Topics and Actions right
Unlike other Agent frameworks like OpenAI assistants which have a single instruction field per Agent, Agentforce is different. And difficult. It has many place where natural language "prompt"...
0 votes
2 answers
116 views
How expensive is this operation to get type of object?
I am doing an update an opportunity from a event, in the trigger I have this List<Opportunity> opportunitiesToUpdate = new List<Opportunity>(); for(Event anEvent : events) { if(String....
1 vote
0 answers
81 views
In Apex, how can I make map keys dynamic?
I have a class with the following methods: public virtual Map<String, List<SObject>> mapBySpecifiedStringField(List<SObject> homogeneousSObjectList, SObjectField idField) { ...
1 vote
3 answers
304 views
Before Trigger - Validate data prior to assigning?
I'm wondering if there's any benefit to adding an if statement to check if data changed prior to modifying in a before trigger (assuming I'd always want that specific value). The example below is ...
0 votes
0 answers
39 views
Is there a way to flip the parent/child data in an instance of SObject without a new SOQL query?
I have the following SOQL: public List<B25__Resource__c> getByIds(Set<Id> resourceIds) { return [ SELECT Id, B25__Parent__c, ...
1 vote
1 answer
538 views
Best Practice - Dynamic SOQL or Static Query within if/else
I'm wondering what is the best practice in a situation where I have a conditional query - do I use an if/else to create my query string and use dynamic query in one place, or use static query and ...
0 votes
0 answers
200 views
Is it ok to import campaign members to a parent campaign?
Currently, we have a hierarchy with parent and child campaigns. Right now, all campaign members are housed in child campaigns. I have a campaign that isn't relevant to any existing parent campaigns, ...
-1 votes
1 answer
174 views
Can we call apex method with the same name but with different letter case in another class?
Can I call a method in another class with the same method name but with different cases. For example a method testMethod() is in classA. And itsl is called as ClassA.TestMethod() in ClassB. Will it ...
0 votes
1 answer
178 views
Using a Custom Object or Standard Object to expose data for integration
I have a requirement to integrate with a 3rd party application for Account data (Account creation). The idea is that Salesforce will be the primary source of truth and the other application will be ...
1 vote
0 answers
80 views
How can I Jest Test an LWC without relying on implementation details and assuming extended HTML does its job?
I have this test: it('handles errors from getDummyApiUsers', async () => { // Arrange const mockError = new Error('Simulated error from getDummyApiUsers'); ...
2 votes
1 answer
2k views
How do you correctly populate an External Credential from a Principal for a Named Credential?
In Salesforce, I want to consume a web API which I can successfully call from my command line like: curl --location 'https://dummyapi.io/data/v1/user?limit=10' \ --header 'app-id: SomeApiKey' In ...
0 votes
0 answers
156 views
SF Campaign Naming Conventions for Evergreen Campaigns
I'm wondering if anyone has suggestions or best practices for campaign naming conventions when it comes to evergreen campaigns or campaigns that run beyond a single fiscal year. Currently, my company'...