Step by Step Salesforce Tutorial – Creating custom object – 1 of 6

Step by Step Salesforce Tutorial – Creating custom object – 1 of n tutorial series

Salesforce.com or SFDC is award wining CRM tool and many companies have started using the Salesforce because of flexibility, userfriendly and lots of applications available.

Prerequesties:

To start with this series, you must have below softwares:

  1. Developer Account of Salesforce
  2. Eclipse with Salesforce Plugin
  3. Internet Connection

Developer Account can be created, free of cost from here.

In previous article i have demonstrated that how to install force.com IDE in eclipse.

So, if you have above softwares then we can start with the actual development of application.

here, i hope that you have setup the eclipse with your salesforce account.

Right click on Salesforce project in eclipse and select Object (Custom object).

Below screen will appear.

Create Custom object Eclipse Salesforce
Create Custom object Eclipse Salesforce

For this tutorial, i am creating student object. so in rest of tutorial we will continue with this object.

We can create a custom object through salesforce also instead of eclipse, check below snap:

Create Custom object In Salesforce
Create Custom object In Salesforce

As you can see in above image :

Go to Setup -> App Setup -> Create -> Objects and click on “New Custom object“.

In the next article i will demonstrate, ho to create Fields in Salesforce.

Related posts

10 thoughts on “Step by Step Salesforce Tutorial – Creating custom object – 1 of 6”

  1. Getting below mentioned error message.
    Force.com Projects require an Organization with the metadata API enabled.
    API is not enabled for this organization or Partner.

  2. Hi , I’ve written a Trigger to assign a task whenever we insert an OpportunityTeamMember to an Opportunity and i also written a Test Case for it but the code coverage is 0%. Can you please check it and tell me where it is going wrong.

    Trigger :

    trigger TaskOnOppTeamMember on OpportunityTeamMember (after insert) {

    list NewTask = new list();

    if(trigger.IsInsert) {

    for(OpportunityTeamMember oppTeam : trigger.new) {

    Task tasksInsert = new Task();

    tasksInsert.WhatId = OppTeam.Opportunityid;

    tasksInsert.OwnerId = oppTeam.Userid;

    tasksInsert.Subject = ‘Great Daddy’;

    tasksInsert.ActivityDate = date.today();

    tasksInsert.Priority = ‘Normal’;

    NewTask.add(tasksInsert);

    }

    }

    Database.insert(NewTask);

    }

    Test Case :

    @isTest

    public class TestCreateTaskTrigger {

    public static testMethod void createTaskTrigger() {

    Opportunity opp = new Opportunity();

    opp.Name = ‘TestOppo’;

    opp.CloseDate = System.Today();

    opp.StageName = ‘Prospecting’;

    insert opp;

    OpportunityTeamMember otMember = new OpportunityTeamMember();

    otMember.OpportunityId = opp.Id;

    otMember.UserId = ‘005900000023dh0’;

    otMember.TeamMemberRole = ‘CFO’;

    insert otMember;

    }

    }

    Thanks,!

    1. How you are adding this hardcoded line “otMember.UserId = ‘005900000023dh0’;”.

      You need to first insert User and then use ID of inserted user in above line.

      1. Hi, I am sorry i am brand new to salesforce so please dont think it as silly doubt and help me. I’ve changed it to below code still it is showing 0% code coverage but the Test is Pass.

        @isTest
        public class TestCreateTaskTrigger {
        public static testMethod void createTaskTrigger() {

        User u1 = [SELECT Id, Name FROM User WHERE Alias=’mruiz’];
        System.debug(‘1111111111111’+u1.Name);

        Opportunity opp = new Opportunity();
        opp.Name = ‘TestOppo’;
        opp.CloseDate = System.Today();
        opp.StageName = ‘Prospecting’;
        System.debug(‘11111111111111’+opp);
        insert opp;

        OpportunityTeamMember otMember = new OpportunityTeamMember();
        otMember.OpportunityId = opp.Id;
        otMember.UserId = u1.Id;
        otMember.TeamMemberRole = ‘CFO’ ;
        System.debug(‘222222222222222’+otMember);
        insert otMember;
        }
        }

        Thanks,!

        1. How you are checking test coverage ? Navigate to Setup | Develope | Apex Test Execution and from this place select your test class and run it. Coverage line will be visible in Development Console.

          1. Hi, After Running the Test class , I am refreshing the Trigger Detail Page where we can see the code coverage : 0% (0/15).

            Thanks,!

Leave a Reply

Your email address will not be published. Required fields are marked *