function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ravi chandra 16ravi chandra 16 

Looking logic

Hi Every One,
Kindly provide  expected solution to below queries.

Declaratively create logic in your org that prevents two Opportunities from being created on a single Account in a single day.
Declaratively create logic in your org that prevents closed Opportunities from being updated by a non System Administrator profile.

Many Thansk in advance.
Bhanu MaheshBhanu Mahesh
HI Ravi,

For first requirement,
You can do this by creating a unique text field on Opportunity and update that field through workflow when a record is created with value
AccountId + TEXT(CreatedDate)

This unique field will give you error when creating second opportunity for the same Account on the same date.

Refer the below link how to proceed for your reference
http://focusonforce.com/configuration/preventing-duplicate-records-with-salesforce-config/

For Second requirement you can create a validation rule to prevent other profiles to edit the closed opportunity

Validation rule formuala will be ;   IsClosed  && NOT($Profile.Name = 'System Administrator')

Try these and let me know if you need any help.

Regards,
Bhanu Mahesh
ravi chandra 16ravi chandra 16
Thank you very much Bhanu 
Namita Upadhyaya1Namita Upadhyaya1
I also got stuck with the same requirement! Now it seems so simple with your solution ! thnks