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
visualforce_devvisualforce_dev 

Creation of formula field using java api and syntax checking

Anybody here have sample code for formula field creation from java code?
 
Thanks in advance
 


Message Edited by visualforce_dev on 01-19-2009 02:44 AM
visualforce_devvisualforce_dev

We can create formula field using following commands

based on outout type create a custom field, then setformula with a formula(string) as parameter.

now can any body pls help me in checking the syntax of formula.

Regards'

Code:
if(formulaType.equals("Currency"))
                       { nf1.setType(FieldType.Currency);
                           nf1.setPrecision(2);
                           nf1.setScale(0);
                       }
                      
                       String formula1="Field1__c+Field2__c";
    nf1.setFormula(formula1);

where nf1 is the field name variable.