Archive for February, 2008

Help! I need to Lock an Opportunity after Close!

February 20th, 2008 by James Sullivan | 2 Comments | Filed in Salesforce.com

Problem: We’re using a “Closed Won” Opportunity as a financial booking and we need a way to lock the record from people editing it once it reaches this state. This also means we can’t allow people to modify the Opportunity LineItems (aka Opportunity Products).

Solution: Validation Rules to the rescue!

I originally searched Google / SFDC Help for validation rules and triggers for delete but didn’t find any articles that made it apparent. A validation rule is executed any time a record is saved either through the Salesforce.com Application or through the API (including Outlook, Excel Connector, and custom code). In our case, Opportunities are only allowed to be deleted by Admin role (me). This means that they can only be edited (1/2 the battle).

This means we need two Validation rules…

  1. Disallow editing of an Opportunity once the stage is “Closed Won”: and(PRIORVALUE(StageName) = “Closed Won”, not( $UserRole.Name = “Finance”))
  2. Disallow editing of Opportunity Products once the Opportunity Stage is “Closed Won”:  AND( NOT($UserRole.Name = “Finance”), ISPICKVAL( Opportunity.StageName , “Closed Won” ))

Now, when someone (sales, support, whoever) tries to edit the Opportunity to change the date, they will receive the error message from validation rule 1, hopefully stating they need to go to finance to make changes.  If someone tries to update an Opportunity Product amount, description, or custom field they will receive an error from validation rule 2.  In this example, only Finance can edit your Closed Won Opportunities but you could also unlock it for Admin or other roles depending on the size of your organization.

This was implemented for use in a close process where Salesforce.com is tied out completely to contract values so we can use Lucidera and Salesforce.com reports for real business decisions as we are completely confident the data is correct.  What do you think?

Salesforce.com: Start and Approval Process from custom links and buttons

February 1st, 2008 by James Sullivan | 1 Comment | Filed in Salesforce.com

We have adopted an Opportunity close process using Approval Processes in Salesforce because I rely on Salesforce.com for the majority of the bookings reporting. To make the data more reliable there is now a process that requires the approval process to change the Opportunity stage to “Closed Won”, what we now consider an “Order”.

To make it more intuitive to the salespeople, we wanted to have a link or button at the top of the Opportunity titled “Convert to Order” which would kick off the approval process. Here is a picture of it in action, a button that submits for approval:

Screenshot of Convert to Order Button

Want to do the same thing?
Navigate To: Setup > Customize > Opportunities > Buttons and Links
Press the “New” button and use these details:
Label: Convert to Order
Name: Convert_to_Order
Display Type: Detail Page Button
Behavior: Execute JavaScript
OnClick JavaScript: if ((Modal.confirm && Modal.confirm(‘Once you submit this record for approval, you might not be able to edit it or recall it from the approval process depending on your settings. Continue?’)) || (!Modal.confirm && window.confirm(‘Once you submit this record for approval, you might not be able to edit it or recall it from the approval process depending on your settings. Continue?’))) navigateToUrl(‘/p/process/Submit?id={!Opportunity.Id}&retURL=%2F{!Opportunity.Id}’);

  • Author

    Here you can provide some author or blog infomation.