Salesforce関連の記事を書いています。

  1. Salesforce

How to create an item that only the record owner and system administrator can edit

In this article, we will discuss how to allow only the record owner or system administrator to edit certain items in Salesforce.

This setting can be achieved by writing a formula in the input rule as shown below. Here we will explain how to make an item with the API reference name “Sample__c” editable only by the record owner and the system administrator.

First, copy the item API reference name of the target object. Then, select “Input Rules”.

Then, enter the following as shown in the figure below.

AND(
ISCHANGED( Sample__c ),.
NOT(
OR(
$Profile.Name = "System Administrator",.
OwnerId = $User.Id
)
)
) )

The elements of the above formula are explained one by one.

  1. AND(...) ISCHANGED( Sample__c ):Raises an error if all conditions are True.
  2. ISCHANGED( Sample__c ): True if the Sample__c field is modified.
  3. NOT(...) True if the internal condition is not true.
  4. OR(...) ):True if any of the internal conditions are True.
    • $Profile.Name = "systemadmin “: True if the current user’s profile name is “systemadmin”.
    • OwnerId = $User.Id: True if the record’s owner ID matches the current user ID.

Thus, the formula can be interpreted as follows

  • Sample__c if the field is modified.
  • If the current user is neither the “system administrator” nor the owner of the record
  • an error is generated.

To summarize, this formula means that if a user other than the system administrator or record owner attempts to modify a Sample__c field, an error will be generated.

In this explanation, we have set it up so that the “system administrator” can also edit the item. This is to prevent the record owner from being unable to edit an item due to sudden absence or resignation of the record owner. After making various assumptions, let’s find the best way to set up the system!

Salesforce recent post

  1. What are Salesforce input rules? Explanation …

  2. You must be using Office365 (Microsoft365) to…

  3. How to loop a specified number of times in a …

  4. How to create an item that only the record ow…

  5. How to have Salesforce automatically enter to…

関連記事

PAGE TOP