3

In our organization we are using quote as visualforce page. So i am using validation rule in this criteria:

if($Profile.Id='00e90000000erfV',(AND(
(ischanged( Subject__c)),
OwnerId <> $User.Id
)),false)

In this record owner only able to edit his record i need the record can be able to modify by three other users:

$User.Id='00590000000fmwp',
$User.Id='00590000001A7Pc',
$User.Id='00590000001A6jh' 

How i can include these three user in this validation rule. But they can't be able to edit other profile id records?

1
  • Any body can try this one
    – Teja
    Commented Nov 7, 2013 at 12:12

1 Answer 1

1

You don't the IF, as your dealing with functions that return booleans anyway, so using the IF to return a boolean is redundant and unnecessary.

As a best practice you really should not hard code IDs into your validation rules. If you need specific users to be able to do certain things, you should try to group them in similar roles or profiles, and then you can use the role or profile name in your validation rule.

Something like this should work, but I wouldn't recommend

AND(
    ISCHANGED(Subject__c),
    OwnerId <> $User.Id,
    NOT(
         $User.Id='00590000000fmwp',
         $User.Id='00590000001A7Pc',
         $User.Id='00590000001A6jh'
    )
)

I would suggest trying to identify the users by a profile or role if possible, and dont use the Id of that profile or role, but the name. Say the users were all in a profile 'Profile-x'.

EDIT From Comment Info

Something like this is preferable

AND(
    ISCHANGED(Subject__c),
    OwnerId <> $User.Id,
    Owner.Profile.Name = 'YourProfileName',
    $Profile.Name <> 'YourProfileName'
)

Not totally sure I understand the requirements but the above now checks for the profile of the record owner as well as the profile of the current user. You can adjust accordingly, but I think this is what you are looking for.

9
  • hi thank you for your valuable reply .i need that he can able to edit his profile user records but not other profile users
    – Teja
    Commented Nov 7, 2013 at 16:57
  • in your scenario user can able to edit all other profile user records
    – Teja
    Commented Nov 7, 2013 at 16:58
  • do you have any other idesa\
    – Teja
    Commented Nov 7, 2013 at 16:59
  • I guess I don't understand what you are asking. you seem to be mixing the idea of validation with Sharing rules. You want the user to only be able to edit the record if they have the same profile as the owner of the record? Commented Nov 7, 2013 at 17:01
  • YES EXACTLY .only for this USA profile,any body can able to edit any record of (USA PROFILE) .for other profiles, it is different scenario i already wrote one validation rule for other (FRANCE AND INDIA)profiles.
    – Teja
    Commented Nov 7, 2013 at 17:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .