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
Bhola VishwakarmaBhola Vishwakarma 

using formula field

how can i use my recordtype name in my formula field to check the condition 

Chamil MadusankaChamil Madusanka

You can use formula field type in your custom object. I'll give a example for understad the why and when we need to use fomula field.

 

Let's say we have a object called Employee__c and it has DateOfBirth__c custom field. Now we are going to create formula field called Age__c in our Employee custom object. I'll use following formula to calculate the age by using DateOfBirth__c custom field value.

 

IF(MONTH(TODAY())>MONTH(DateOfBirth__c),YEAR(TODAY())-YEAR(DateOfBirth__c),IF(AND(MONTH(TODAY())=MONTH(DateOfBirth__c),DAY(TODAY())>=DAY(DateOfBirth__c)),YEAR(TODAY())-YEAR(DateOfBirth__c),(YEAR(TODAY())-YEAR(DateOfBirth__c))-1))

 When we create or update a employee this fomula will be calculated the age of particular employee and we can use that age value for some validations as well (eg : Age > 18).

 

If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

 

Chamil's Blog

Bhola VishwakarmaBhola Vishwakarma

thanks chamil for ur rpl my question is that 

i have a recordtype called stocks in my Asset_c so i want to use that recordtype name 

in my formula field 

 

so how should i go about it

Chamil MadusankaChamil Madusanka

Hi,

 

You can get the recordType nam ein formula field. You need to create a formula field with text return type. Under formula Option;

 

Select Field Type as $RecordType and Insert Field as Name.

 

Save it.

 

Then when you create or edit your object instance you will get the recordtype name in formula field.

 

This is a screen shot of above description

http://www.flickr.com/photos/23948703@N08/5954084978/

 

Is that your requirement?

 

If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.