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
BNB BaluBNB Balu 

how to add 3 fields and total sum auto filled in field 4 in model of salesforce? how to achive this in salesforce Model? Not At view?

I want to use like  this formula....Monthly_Common_Bill__c = (Room_cost__c + Net_Bill__c + power_bill__c) / Number_of_peoples__c
where i can put this formula.Actually I Tried This formula
1.at custom field(Monthly_Common_Bill__c), in select formula, select currency as the return type, then in the formula area enter above formula:
2.tried at Validation rule also.
this above twotypes its not working.please give me ur valuable answer.Thanks in Advance....User-added image
BNB BaluBNB Balu
User-added image
Naveen Rahul 22Naveen Rahul 22
Hello Balu,

you can use this in your forumula field
 
VALUE(Room_cost__c + Net_Bill__c + power_bill__c) / VALUE(Number_of_peoples__c)

the above will work as you expect.

Hit like if its works.

Thanks
D Naveen Rahul.
BNB BaluBNB Balu
Thank you Naveen for your response...
But Above code is not working.shows Error: Invalid Data. Review all error messages below to correct your data.
 
harika jharika j
Hi Balu,
Please try below code

Field1__c,Field2__c,Field3__c are currency datatype fields, whereas Total__c is formula field (Field1__c  +  Field2__c  +  Field3__c)


<apex:page standardController="Test__c">
 <apex:form >
 Field1  :  <apex:inputField value="{!Test__c.Field1__c}"/><br></br><br></br>
 Field2  :  <apex:inputField value="{!Test__c.Field2__c}"/><br></br><br></br>
 Field3  :  <apex:inputField value="{!Test__c.Field3__c}"/><br></br><br></br>
Total    : <apex:outputField value="{!Test__c.Total__c}"/><br></br><br></br>

<apex:commandButton value="save" action="{!save}"/>
 </apex:form>
 
</apex:page>

Thanks,
Harika