Wednesday, September 11, 2019

differences between standard fields and custom fields

SNO
Standard Fields
Custom Fields
1
These are ready made  fields which are provided by salesforce by default(id,name created by,last modified by,owner)
Base on the project requirement salaesforce developer/admin can create their own required fields inside the object which are called custom object
2
We can customize the standard fields based on the need but we cant remove the standard fields
We can customize/remove the custom fields when its no longer used
3
We cant create any more standard fields any more
We can create one/more custom fields inside object upon needed
1 in free developer edition : 500 maximum objects
2. unlimited edition : 800 custom fields
4
Each standard field contains 2 properties
1.      Filed label : represents the fields static tet to be visible inside the user interface
2.       Field Name : represents the actual column inside the table
Each custom filed contains 2 properties
1 Filed label :represents field static text o the UI
2 API Name : represents actual name inside the table
Note : always we have to use field name to interact with the object, through programming
5
Standard fields available for both standard and custom objects
Custom fields can be applicable for both standard/custom objects
6
Standard fields name looks like as normal (ex : name id,rating etc)
Custom fields name will be post prefix’s with ‘__c’
__c à represents the custom filed

Monday, September 9, 2019

creating custom object in salesforce classic

Tab : to provide GUI(Graphical user interface) by which user/customer/partnere can manage the records inside the object.

-->   An object can have only one tab(one to one association)

upon creating the custom object if the user didnot select the check box "Launch new custom tab wizard after saving the custom object", the salesforce wonot create any Tab for that object.We need to create tab by manually.

Salesforce having 4 types of objects

1) custom objects : feature is used to create tab to used to manage the records exists inside the object
2) Web Tabs : these are used to re-direct the user to specified URL/Path of external application
3) visualforce Tabs : can re-direct user to the specified visualforce page  upon click on Tab.
4) Lightning Tabs : can re-direct user to specified Lightnng page.

Navigation: 

Setup menu
1)click on build menu in left panel
2) click on create option and expand it.
3) click on tabs
4) goto custom objects tab
5) click on new button
6)select the required object name from the picklist to create the tab
7) select tab style
8) click on next
9) make tab to get visible for all the profile users
10) next ---> save



Custom Field creation in Salesforce classic

Custom Field : which will created by Salesforce Admin

Below are the Two ways to Create a custom field in salesforce

A)By Navigation :

1) Clicko on setup which resides on right top of the salesforce page.
2) Go to Build Menu in left side
3) Expand appropriate object(Ex: Accounts)
4) Click on Fileds
5) Go to Account Custom Fields & Relationships section in Right panel
6) Click on New Button
7) select appropriate 'Datatype' of field
      Entet Field Label and Filed Name (Based on the filed label filed name will display automatically and select appropriate properties based on the requirement).
8)Click on Next
9) select visible check box to visible field to all profiles.
10) Click on Next
11)select Page layout on which page(s) it needs to be visible.
12) Click on Save.

B) Schema Builder:

1) Click on Setup
2) Go to Build menu then you can find SchemaBuilder option
3)Click on Schemabuilder it will open panel which contains all object and their Relationships.
4) Select on which object you need to customize fields
5) Go to 'Elements' Tab on the left panel
    It will provide all available filed type drag fields appropriate filed type and  drop the field to customize object release the cursor it will provide a UI enter the filed Label click on Save.
It will create field in the object.

Note: By using schema builder if we create the custom field the created filed won't be visible in the appropriate Tab. For this we need to use Pagelayout concept.

Thursday, September 5, 2019

days remaining in sf formula


  1. click on setup
  2. go to build menu
  3. expand appropriate sfobject 
  4. click on fileds
or
  1. expand force.com quick access menu
  2. click on view fields

Goto custom fileds & relationships
click on new
select datatype as 'formula' and click on next
provide filed lable name upon field label name filed field name will auto populate
then select Formula Return Type  click on next
enter formula in formula editor window
 ex: EndDate  - today()
click on next and provide visible and readonly access click n next

select pagelayout and save

insert Account object

public class AccountHandler {
    Public static void  insertAccount(integer value)
    {
        integer counter=1;
        List<Account> addAccounts=new List<Account>();
        while(counter<=value)
        {
            
            system.debug('counter value before increment'+counter);
            Account acc1=new Account();
            acc1.Name='Acme Inc n'+counter;
            acc1.AccountNumber='A000'+counter;
            addAccounts.add(acc1);
            //System.debug(addaccount);
            
            //increment the counter
            counter = counter + 1;
            System.debug('Counter Value after incrementing ' + counter);
            
        }
        insert addAccounts;
        system.debug(addAccounts);
    }

}

string array

public class StringArrayTest {
    public static string[] generateStringArray(integer value)
    {
        //string[] s;
       string [] s = new List<String>();
        for(integer i=0;i<=value;i++)
        {
            s.add('Test'+i);
            
        }
        system.debug(s);
        return s;
    }

}