I have two fields in an object, Total_Casual_Leaves__c (Formula) 15 is constant value for it. Days_Requested__c (Number) that is user input. Now i want to write a formula for Remaining_leaves__c after Days_Requested__c taken. for that i am trying to write something like this

    ISPICKVAL( Type_of_Leave__c , "Casual Leave"),
    ISPICKVAL(Type_of_Leave__c, "Sick Leave")
   Total_Casual_Leaves__c -  Days_Requested__c ,
   Total_Sick_Leaves__c  -  Days_Requested__c 

Its working fine for one instance but if i create a new record then its taking 15 records as total leaves . If i enter a new record then it must calculate using Remaining_leaves__c. Could any one help me out

  • Is your Total_Casual_Leaves__c field in formula type?
    – highfive
    May 20, 2014 at 5:19
  • @highfive yes its formula type with a constant value 15 in it May 20, 2014 at 5:21

1 Answer 1


Formula are limited for that specific record. In formula you can not refer other records from same object. If you want o do that then you will need to use trigger and write your won logic.

  • 1
    If Salesforce developer's fields are in the detail object of a master-detail relationship, they might be able to solve their problem using roll-up summary fields and a formula field on the master object.
    – georg w.
    Aug 27, 2014 at 9:26

You must log in to answer this question.

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