You'll have to enter the profile id of your own system admin profile, but this will prevent any of your other users from moving an opportunity to "Closed-Won". They won't be able to edit the Won opportunity either.
Every record in sfdc has a 15 digit unique id. You can see the id in the URL or browser address field when you open the record (account, opportunity, user record, etc). $Profile.ID refers to the 15 digit id of the specific user profile record (System Admin, General User, etc) that you want to test against.
If you open the user profile record, System Administrator, and look at your browser address bar, you'll see the 15 digit id following http:// www. salesforce. com/
Click on the Insert Field button while editing your rule. You should see the following:
Opportunity
$ObjectType
$Organization
$Profile
$RecordType
$User
$UserRole
Select $Profile....Profile ID and then click the Insert button. It will insert the field $Profile.Id into your validation rule. That should avoid any spelling errors.
I'm assuming this is available in Professional edition.
I don't think the ID that you have in your rule is actually a user profile id. All the profile id's in my developer and production versions of sfdc begin with "00e" and the id you have listed starts with "005".
Try this. Replace
$Profile.Id<> "0053000000xxxxx" with $Profile.Name <> "System Administrator"
If needed replace "System Administrator" with the name of your actual user profile. If you are not sure what your profile name is, it's listed on the top right side of your sdfc user record.
By the way, if you don't already have a developer account, you should get one. You don't really want to be creating/testing new validation rules on your production instance of the application.
If you need any more help, feel free to take this offline by emailing me at aiden. martin @ aliant. ca
This is a really cool idea . . . I think it might help us but our situation is a little different. Our Sales Ops folks want to mark opportunities that have been "validated for commission payment" with a check box and then lock out changes to the Opportunity by pretty much everyone once that box is checked off. I have an idea to change the Record Type and check that box using an S-control . . . so the new Record Type will have a page layout for the sales reps that will set the fields to read-only. But the HUGE problem is that Stage and Close date cannot be made read only.
Is there a way to set up the formula you suggest to look at a check box being "true" and to then to produce errors if the Stage and/or Close Date fields are changed from the current values by anyone other than a couple specified profiles (like admins, commissions, etc.)? I guess it would be a separate validation rule for each field . . . but let's say Stage---how would you list multiple profiles as OK to edit but any change from the current values would error out?
Does that make sense???
Worst case scenario is that only admins could edit those fields and to leave it at that.
With validation rules you don't need to create record types anymore to prevent changes to an opp once it has a certain stage or other fields have specific values.
If you want to lock your opportunity for ALL users when the "Validated for Commission" field has been checked try this:
PRIORVALUE (Validated__c) = True
To lock it for all users except the Administrator where "00et0000000xxxx" is the id of your admin profile, try:
WOW . . . Thanks, Aiden!!! We will give this a shot and see how it works.
So this locks out ANY changes to the record, including products on opportunities? This would be HUGE for us to control some things without going through all the extra gymnastics.
The validation rule(s) that I provided will prevent changes to the opportunity record. The rules provided in the help file will help you prevent changes to the opportunity products.
Hi Mayling,
Try this:
And(
Or(IsPickval(StageName,"Closed-Won"),
ispickval(priorvalue(StageName),"Closed-Won")
),
$Profile.Id<> "00e70000000xxxx"
)
You'll have to enter the profile id of your own system admin profile, but this will prevent any of your other users from moving an opportunity to "Closed-Won". They won't be able to edit the Won opportunity either.
Every record in sfdc has a 15 digit unique id. You can see the id in the URL or browser address field when you open the record (account, opportunity, user record, etc). $Profile.ID refers to the 15 digit id of the specific user profile record (System Admin, General User, etc) that you want to test against.
If you open the user profile record, System Administrator, and look at your browser address bar, you'll see the 15 digit id following http:// www. salesforce. com/
Aiden
Aiden,
That is so cool. I never knew that was there. But is will not take it. This is what I am typing in:
And(
Or(
IsPickval(StageName,"Closed-Won"),
ispickval(priorvalue(StageName),"Closed-Won")
)
$Profile.Id<> "0053000000xxxxx"
)
or(IsPickval(StageName,"Closed-Won"),
ispickval(priorvalue(StageName),"Closed-Won")
),
$Profile.Id<> "00e70000000xxxx"
)
Message Edited by AMartin on 04-08-2008 05:59 PM
Message Edited by AMartin on 04-08-2008 06:00 PM
Or(
IsPickval(StageName,"Closed-Won"),
ispickval(priorvalue(StageName),"Closed-Won")
)
,
$Profile.Id<> "0053000000xxxxx"
)
Now I keep getting an error message in the Syntex: Field$Profile.Id does not exist. Check spelling.
I have tried everything, and it is not working. Is it because we have Professional version?
Mayling
Hi Mayling,
I don't think the ID that you have in your rule is actually a user profile id. All the profile id's in my developer and production versions of sfdc begin with "00e" and the id you have listed starts with "005".
Try this. Replace
$Profile.Id<> "0053000000xxxxx"
with
$Profile.Name <> "System Administrator"
Aiden:
This is a really cool idea . . . I think it might help us but our situation is a little different. Our Sales Ops folks want to mark opportunities that have been "validated for commission payment" with a check box and then lock out changes to the Opportunity by pretty much everyone once that box is checked off. I have an idea to change the Record Type and check that box using an S-control . . . so the new Record Type will have a page layout for the sales reps that will set the fields to read-only. But the HUGE problem is that Stage and Close date cannot be made read only.
Is there a way to set up the formula you suggest to look at a check box being "true" and to then to produce errors if the Stage and/or Close Date fields are changed from the current values by anyone other than a couple specified profiles (like admins, commissions, etc.)? I guess it would be a separate validation rule for each field . . . but let's say Stage---how would you list multiple profiles as OK to edit but any change from the current values would error out?
Hi,
With validation rules you don't need to create record types anymore to prevent changes to an opp once it has a certain stage or other fields have specific values.
If you want to lock your opportunity for ALL users when the "Validated for Commission" field has been checked try this:
PRIORVALUE (Validated__c) = True
To lock it for all users except the Administrator where "00et0000000xxxx" is the id of your admin profile, try:
AND(
PRIORVALUE (Validated__c) = true,
NOT($Profile.Id = "00et0000000xxxx")
)
To allow multiple profiles to bypass the validated checkbox:
AND
(
PRIORVALUE (Validated__c) = true,
NOT($Profile.Id = "00e30000000dsb"),
NOT($Profile.Id = "00e30000000dxxxx"),
NOT($Profile.Id = "00e30000000dxxxx")
)
WOW . . . Thanks, Aiden!!! We will give this a shot and see how it works.
So this locks out ANY changes to the record, including products on opportunities? This would be HUGE for us to control some things without going through all the extra gymnastics.