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
MaheemSamMaheemSam 

Like ISNEW() function do we have any method for delete

Hi, 

   Like ISNEW() function is there any methods or way to identify a record a deleted please suggest. 

  I want to avoid users deleting from quotelines when quote is approved or pending 

Thanks
Sudhir
Lokesh KumarLokesh Kumar
Create a roll-up summary field on the Quote and write a validation rule to check the count of that field eg 

Number_of_Line_Items__c <
PRIORVALUE(Number_of_Line_Items__c) )

Here is the help article for Opportunity But can be used for quote as well
https://help.salesforce.com/articleView?id=000326315&type=1
GauravendraGauravendra
Hi Sam,

Salesforce provide standard field "IsDeleted", its value will be True if the record is deleted and currently residing in Recycle bin and False, if record is not deleted.
Hope that helps!
Khan AnasKhan Anas (Salesforce Developers) 
Hi Sudhir,

Greetings to you!

No, there is no out of the box function like ISDELETE() or ToDelete() for formula. You can write a trigger to do this.

There's an idea which is active on the success community with a similar discussion for which you can upvote so that it gets available in the future.

https://success.salesforce.com/ideaView?id=08730000000BrGiAAK

https://success.salesforce.com/ideaView?id=08730000000DlPBAA0

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Lokesh KumarLokesh Kumar
Hi Gauravendra, To implement this you need to write code. The solution I have suggested can be done using config No code.
Khan AnasKhan Anas (Salesforce Developers) 
+1 @Lokesh

If you don't want to write a trigger use the validation rule as suggested by Lokesh. The formula should be like this:
AND(
   OR(
      ISPICKVAL(Status, "Approved"),
      ISPICKVAL(Status, "In Review")
   ),
   Number_of_Line_Items__c < PRIORVALUE(Number_of_Line_Items__c) 
)

Validation Rule is on Quote object.
Number_of_Line_Items__c is a custom roll-up summary field on Quote.

Regards,
Khan Anas
MaheemSamMaheemSam
Thanks Lokesh this was very simple I am testing all scenaiors will update you shortly when complete. 

Thanks
Sudhir