Tagged Questions

Referring to the use of recognized community and platform best practices. May relate to all areas of lifecycle and all development and administration activities.

learn more… | top users | synonyms

1
vote
2answers
64 views

How do I test an apex trigger that sends an email

Trigger is: trigger emailtemplate on opportunity(after update) { List<opportunity> oList = Trigger.new; List<opportunity> nList = trigger.old; ...
1
vote
1answer
27 views

Change Contact Owner for Profile

I have a case in which a certain user with profile that should be able to transfer a contact even the contact is still not his own. I tried using the 'Transfer Record' in both the profile and ...
3
votes
1answer
38 views

Best Practices for Validate field in Salesforce

Hi, This is my scenario, - Object Name: Contact . - Field: -Status__c (Picklist) contains: Active ,Inactive or NULL -StatusDetail__c (Text) The requirement is whenever Status not null , ...
2
votes
0answers
30 views

What is the Best Practice for the right Training Environment?

As we all know, good user trainings are crucial to ensure a high adoption rate and a successful CRM strategy. I'm hired quite regularly by customers to provide enduser trainings. Always there is the ...
8
votes
3answers
165 views

Checking 'Correct' Previous value method in Trigger design best practice

One of the most common questions on this forum is around trigger recursion. There are a few standard ways to prevent recursion. My method of choice when it comes to checking for field changes, is ...
0
votes
1answer
87 views

Salesforce deployment best practices

I am very new to Salesforce .In salesforce , there is no clear strategy for release management and I am asking the wider Salesforce community to help me to see if the proposed release plan is OK. The ...
5
votes
2answers
133 views

What controls the 'severity' of ApexPages.addMessages(exception)?

I'm trying to crystallize out some 'best practises' for Visualforce Page exception handling. I think, at a minimum, a page should look something like this: <apex:page ...
1
vote
2answers
35 views

Worrying about cross browser compatibility

Do we have to worry about rendering our salesforce custom page to different browser? If so, what are the things needed and to consider to solve or to have good practice developing a custom page ...
1
vote
1answer
78 views

BestPractice: Displaying Months on Visualforce Page

Is this a good practice in displaying months? Code Snippet: <b>{!CASE( IF( (MONTH(TODAY()) +3) > 12, (MONTH(TODAY()) +3) - 12, MONTH(TODAY()) +3), ...
-3
votes
1answer
67 views

Best Practices to call on-premise webservice from Salesforce

what is best way to call the on-premise ws from salesforce. How can we make the connection and do the handshaking ? Regards. Ankit
7
votes
4answers
688 views

BestPractice: Defining and populating Collections

What is the best practice when using collections. Example: This snippet: shortStudentMap = new Map<string,string>(); shortStudentMap.put('1', 'Student1'); shortStudentMap.put('2', ...
1
vote
1answer
51 views

Best practices for designing a Custom Object. Experts please adivce

I am trying to design a custom object which i'm wondering if there could be any best practices regarding object design. i.e., Custom object design: Single record with multiple fields or Many ...
10
votes
2answers
75 views

Apex Modular Programming

I have a big Apex controller of a visual force page ,2500 lines of code, so i m wondering how can i separate implemented features in different module according to the topic. DealRowEdit(Apex ...
2
votes
1answer
34 views

How do I deactivate a picklist option in Professional Edition?

I have a picklist on Opportunities called "Demo Set By", which lets us recognize the Sales Development Executive who set up a demo (not the same as the owner of the opportunity, which is the Account ...
6
votes
2answers
563 views

General trigger bulkification - best practices

A general question asked from time to time on stack exchange is question of trigger bulkification. Therefore I have 2 questions: Which best practices are you using? What is the best way to handle ...
6
votes
2answers
230 views

First trigger: coding - best practices

This is my first production trigger and I'm just wondering if there is a more efficient way to write this code. Basically, if a campaign meets the criteria in the IF statement, I want it to create a ...
1
vote
2answers
310 views

How to avoid recursive trigger other than the classic 'class w/ static variable' pattern?

How can we avoid trigger get executed again and again (recursive trigger)? One way is to have a class with static variable and have boolean value and check it is true or false and changing the boolean ...
16
votes
1answer
320 views

Does an Apex or VisualForce code style guide exist?

Has anyone written an Apex or VisualForce code style guide, in the way of the Ruby Style Guide or jslint, or PEP-8, or any number of Java guides? I'm in the process on creating one for internal use ...
10
votes
1answer
224 views

Consolidate trigger methods or not?

I have a general best practices question about triggers. I have created a handful of triggers that perform different actions but are called by the same event, such as after account ...
8
votes
3answers
312 views

apex:include vs. Visualforce component, when and why?

I recently had a reason to look more closely at the standard apex:include component in Visualforce, and I'm intrigued by the intent behind this component. Would anyone be willing to share some ...
4
votes
1answer
325 views

SOQL: prevent SOQL injection - best practices

I have a query string that is as follows(no bulkification required)... String qryString = 'SELECT Id FROM Contact WHERE (IsDeleted = false and Name like \'%' + searchText+ '%\')'; searchText is a ...
1
vote
1answer
93 views

ExactTarget v5 Salesforce Integration - Tracking Analytics and Using Campaigns

My organization recently started using the v5 ExactTarget integration with Salesforce and I'm wondering if there are some best practices on using Campaigns with ExactTarget. At this point, we only use ...
4
votes
2answers
1k views

Is this good coding practice?

Today I have been going through some triggers written by former consultants and it seems like they "brute force" some stuff. It may be fine that that did it this way but it seems like to me it could ...
4
votes
1answer
272 views

Implementing Trigger Framework(KevinOHaras)

I've been researching some best practices, and trigger frameworks and I found Kevin O'Haras TriggerHandler Framework. Now I don't fully understand it, I don't understand how to reference the Trigger ...
3
votes
1answer
96 views

VFRemoting escape option

We are currently looking into the best place to handle escaping (html encoding) when using VFRemoting. It had been suggested to us that using always the option {escape: true} was the best approach ...
3
votes
3answers
1k views

Triggers Best practices

We are experiencing performance issues on our org and over the years the size of the org (data + bus logic components like workflows, triggers, fields etc..) have grown rapidly and exponentially. We ...
1
vote
0answers
26 views

Impact of migrating instances

My org is being pushed from na14 from na12 instance, I have a checklist of items mentioned below (not a complete list). I wanted to check with folks out here who have gone through this, if I need to ...
-1
votes
3answers
232 views

Is it advisable to call Batch from trigger

I was thinking of calling a batch class from my trigger. Is is advisable to do that? As batch will have asynchronous execution with respect to trigger.
0
votes
1answer
23 views

Tracking sales data separate from account information

Sales data should be tracked somewhere separate from the Account Information, with Sales data only available to designated Users. What are solutions you would suggest for accomplishing this?
2
votes
4answers
219 views

Business logic in trigger

Why is it a bad idea to write business logic in trigger. The organization that I work for asked me to move all the business logic in to apex class and call it in a trigger. Can anyone explain me why ...
4
votes
1answer
319 views

Best Practice: Type of license for API User

Our Salesforce environment has several API users to connect with various system. We didn't set them up with Streaming APIs (I would like to..), so they run at regular intervals. Because we want to ...
1
vote
1answer
76 views

Integrating php with Salesforce

I am asked to built a web application in php where the back end database is going to be Salesforce Objects. The scenario is that "users" (can be 10,000+) would register/log in to the application and ...
0
votes
1answer
48 views

Support Level Pricing Best Practices

What are best practices around handling Support Level Pricing adders where the adders are not fixed dollar values, but percentages on top of a subscription model (+10%, +25%, etc)? Is this best ...
4
votes
1answer
270 views

custom error message in trigger-for a chatterexception

My use case is to create a more specific error message when user tries to create a chattergroup(in the background by apex). error message is for when user has reached the limit of 100 chattergroups ...
1
vote
1answer
63 views

Best Practices: Scheduled Reports

We are having issues with tons of different users trying to schedule reports, and it is causing others to not be able to schedule their reports because only 2 reports can be scheduled in 1 hour. I am ...
8
votes
3answers
969 views

What are Apex Performance Best Practices?

Is there a definitive guide somewhere that outlines the best practices for faster executing code? I am looking for specifics, like Adding elements to a Set versus to a Map Testing for null before ...
1
vote
1answer
49 views

Testing custom webservices

I develop a custom webservice[SOAP] in salesforce and I want to test that webservice. Is a testclass ok for that custom webservice or should I test additional things.
2
votes
2answers
177 views

Attach attachments to multiple records?

Is there any way to attach Notes or Attachments to multiple records? I had originally thought that the Attachement.Body field was a pointer to the location of an attachment, and I would be able to ...
4
votes
2answers
119 views

How to add an instance method to a custom SObject?

I have a custom SObject named Book. This custom Object has a few Fields: Price Pages AmountInStock How would I go about to get some methods onto Book, such as: String toXML() Boolean ...
7
votes
2answers
275 views

Reliable SOAP webservice callout

Problem I have to build a reliable integration. This means that external callouts should be delivered even if the remote SOAP webservice is down. (when the ws is online) The idea is to keep the ...
0
votes
0answers
35 views

How to make two fields searchable in lookup

I have a custom object called Study with two fields project Name and Drug. Here Project Name is lookup with some another object(Clinical Project) and second field(Drug) is lookup with Clinical ...
20
votes
2answers
1k views

How to use GIT on multi dev environment

I have previous experience using GIT in other development environment and I never had much troubles using it. We where using SVN for salesforce, however we want to migrate to GIT for the uncountable ...
5
votes
1answer
458 views

How to manage the maintenance window or downtime on API and Sites

I was searching on Google about best practices to manage salesforce downtime. But I didn't find good information. I know that salesforce has some "queues" to manage standard services like: WebToLead, ...
2
votes
0answers
940 views

Chatter in APEX (Connect API) with VF: Best practices to avoid limits

I am currently working on using "Chatter in APEX" aka ConnectApi to display feeds from custom object records in a Visualforce page. I am using one VF page with links that re-render the same page but ...
1
vote
1answer
462 views

Case Implementation on Salesforce Communities

I am currently working on an important project on Salesforce communities and one of the tabs that need to be accessible to external users is the cases object(my first crack at communities). I'm doing ...
2
votes
1answer
233 views

Production and sandbox profiles during deployment

I currently maintain two sandboxes. One is a mirror of the current production. The other is a Dev Sandbox which contains all of the new development which will be included in an upcoming release. My ...
4
votes
1answer
217 views

Efficient way to perform grouping without using aggregate SOQL queries

I have an aggregate query that groups my custom object records by 4-5 fields and then returns a sum of currency fields in each grouping. I have multicurrency enabled so this sum of the currency field ...
6
votes
1answer
346 views

The Do's and Don'ts of currency calculations in Apex

Ok, I am not a math expert, but I know about the basics of rounding problematics in programming languages. In one of my apps, I do some quite complex (math-wise and infrastructure -wise) currency ...
1
vote
2answers
64 views

Prevent LDV-problems in own ISV package by auto-indexing packaged fields

In our managed ISV package we have a custom object that in many customer orgs might run into LDV issues as the nature of this object lead to million of records. I know that Salesforce support can ...
6
votes
1answer
114 views

Best Practice to pinpoint bugs in your managed code that only occur in customer orgs

When code in a managed package fails in a customer org it does not produce logs. This is a serious problem for the ISV that needs to provide a fix but is unable to reproduce the bug in his development ...