• meet.siva
  • NEWBIE
  • 25 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 14
    Replies

Hi,

I have two custom objects Opportunity_CRM__c and Test__c. Each custom fields in Test__c is populated using data from Opportunity_CRM__c based on some conditions.

There is no relationship between the two custom objects.

 

For example:

 

Total_Opportunities field in Test__c takes total count of opportunities from Opportunity_CRM__c and Total_Opportunities_Closed_Won field in Test__c takes total count of closed won opportunities from Opportunity_CRM__c.

 

All fields are grouped based on employee_ID__c field.

 

Is there any way to write Soql sub query?

 

Regards

S.Sivakumar

Hi,

 

I have two custom fields Employee_ID__c and Tenure_Months__c in custom object Test__c

 

Custom fields are populated as below,

 

                     Employee_ID__c             Tenure_Months__c

                            1                                          77

                            2                                          80

                            3                                          4

                            4                                          5

                            5                                          60

                            6                                          52

                            7                                          15

                            8                                          12

 

 

I need to create a bar chart as follows

 

X-axis - Tenure in months

Y-axis - Number of employees

(i.e) i have to group count of employees by tenure

 

I am new to visualforce development. So, Please help me with code.

 

Regards,

S.Sivakumar

 

Hi,

 

I have two soql query.

 

1.) List<AggregateResult> result = [Select Employee_ID__c, Start_Date__c, Count(Amount__c)tcnt, Sum(Amount__c)tvalue from Opportunity_CRM__c group by Employee_ID__c,Start_Date__c];
   

2.) List<AggregateResult> result1 = [Select Employee_ID__c, Start_Date__c, Count(Amount__c)tcnt1, Sum(Amount__c)tvalue1 from Opportunity_CRM__c where Stage__c = '7-Closed Lost' group by Employee_ID__c,Start_Date__c];

 

i need to join these two queries such that final list contains

 

Employee_ID__c, Start_Date__c, Count(Amount__c)tcnt, Sum(Amount__c)tvalue, Count(Amount__c)tcnt1, Sum(Amount__c)tvalue1.

 

Please help me with code.

 

Regards,

S.Sivakumar

 

Hi,

 

I have to insert unique records(i.e remove the duplicates) from some  custom field (say employee_id) in one custom object into another custom field in another custom object.

Can anyone share some working code? It will be helpful.

 

Regards,

S.Sivakumar.

Hi,

 

I have employee_id__c field in custom object Opportunity_CRM__c. It has duplicate values as single employee can create multiple opportunities. I have to insert unique employee_id from Opportinity_CRM__c into employee_id__c field in another custom object test__c. Insert operation is successful using trigger below. But i cant eliminate duplicate values. So plz help me.

 

trigger employee_id on Opportunity_CRM__c (after insert) 
{
        List<Test__c> test = new List<Test__c>();
        Set<Opportunity_CRM__c> myset = new Set<Opportunity_CRM__c>();
        List<Opportunity_CRM__c> mylist = new List<Opportunity_CRM__c>();                                                        
        List<Opportunity_CRM__c> result = [select Employee_ID__c from Opportunity_CRM__c];
        for (Opportunity_CRM__c s : Trigger.new) 
        {
            if (myset.add(s)) 
            {
               Test__c mytest = new Test__c();
               mytest.Employee_ID__c = s.Employee_ID__c;
               test.add(mytest);
            }
        }
       try 
       {
            insert test; 
       } 
       catch (system.Dmlexception e) 
       {
            system.debug (e);
       }
    }

Is creation of custom object possible with apex and metadata API?

 

Help me plz

 

Regards,

S.Sivakumar

I have custom object Opportunity_CRM__c. Once i upload the data into it i have to create another custom object test__c automatically with employee_id__c as one field.?(i.e dynamically i have to create the custom object) can any one give me the logic to implement this?

 

regards,

S.sivakumar

Is it possible to access the overall backend database of standard objects of an organization from apex class?If possible,explain me with an example.

 

For your kind information i am using developer edition in force platform.

 

Its urgent.Please help me.

 

Regards,

S.Sivakumar

Is it possible to create custom objects from apex class dynamically (i.e) during runtime?If it is possible,explain me the steps with an example?

Its urgent.Please help me.

 

regards

S.Sivakumar

Hi, im new to force platform.i have to clarify some doubts.so please help me.

I have two custom objects Opportunity_CRM__c and test__c. Lets consider Opportunity_CRM__c takes the following values,

 

opportunity ID          Employee ID       Amount

        1                                 1                        920

        2                                 1                        400

        3                                 1                        300

        4                                 2                        600

 

 


I have two fields in test__c namely Emploee_Id__c and Totot_count_opportunities__c. I have to populate the custom object test__c with following values,

 

Employee ID              Total Count Opportunities

         1                                     3

         2                                     1

 

i.e. i have to find the total number of opportunities with respect to each employee.

 

My Apex class,

global class opportunity 
{
    global static void totaloppcnt(Opportunity_CRM__c[] op)
    {
            try{
            String eid;
            Integer tcount;
            test__c var = new test__c();
            for (Opportunity_CRM__c w :op)
            {    
                List<AggregateResult> groupedResults = [SELECT Employee_ID__c,COUNT(Amount__c)tntcnt FROM Opportunity_CRM__c GROUP BY Employee_ID__c];
                for (AggregateResult ar : groupedResults) 
                {
                    eid = (String)ar.get('Employee_ID__c');
                    tcount = (Integer)ar.get('tntcnt');
                    var.Employee_ID__c = eid;
                    var.Total_Opp_Cnt__c = tcount;
                    insert var;
                }
            }
            }
            catch(DmlException e) {}
    
      }
}

Initially i gat System.DmlException: Insert failed. First exception on row 0 with id a0R90000002Hg2wEAC; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]..so i used try and catch to overcome that error.After that insert operation is successfully done but im not getting the desired results.

 

My Apex trigger,

trigger oppcnttrigger on Opportunity_CRM__c (after insert,after update) 
{
    Opportunity_CRM__c[] p = Trigger.new;
    opportunity.totaloppcnt(p);
}

Please help me..its urgent..

 

 

Hi,

 

I have two soql query.

 

1.) List<AggregateResult> result = [Select Employee_ID__c, Start_Date__c, Count(Amount__c)tcnt, Sum(Amount__c)tvalue from Opportunity_CRM__c group by Employee_ID__c,Start_Date__c];
   

2.) List<AggregateResult> result1 = [Select Employee_ID__c, Start_Date__c, Count(Amount__c)tcnt1, Sum(Amount__c)tvalue1 from Opportunity_CRM__c where Stage__c = '7-Closed Lost' group by Employee_ID__c,Start_Date__c];

 

i need to join these two queries such that final list contains

 

Employee_ID__c, Start_Date__c, Count(Amount__c)tcnt, Sum(Amount__c)tvalue, Count(Amount__c)tcnt1, Sum(Amount__c)tvalue1.

 

Please help me with code.

 

Regards,

S.Sivakumar

 

Hi,

 

I have to insert unique records(i.e remove the duplicates) from some  custom field (say employee_id) in one custom object into another custom field in another custom object.

Can anyone share some working code? It will be helpful.

 

Regards,

S.Sivakumar.

Hi,

 

I have employee_id__c field in custom object Opportunity_CRM__c. It has duplicate values as single employee can create multiple opportunities. I have to insert unique employee_id from Opportinity_CRM__c into employee_id__c field in another custom object test__c. Insert operation is successful using trigger below. But i cant eliminate duplicate values. So plz help me.

 

trigger employee_id on Opportunity_CRM__c (after insert) 
{
        List<Test__c> test = new List<Test__c>();
        Set<Opportunity_CRM__c> myset = new Set<Opportunity_CRM__c>();
        List<Opportunity_CRM__c> mylist = new List<Opportunity_CRM__c>();                                                        
        List<Opportunity_CRM__c> result = [select Employee_ID__c from Opportunity_CRM__c];
        for (Opportunity_CRM__c s : Trigger.new) 
        {
            if (myset.add(s)) 
            {
               Test__c mytest = new Test__c();
               mytest.Employee_ID__c = s.Employee_ID__c;
               test.add(mytest);
            }
        }
       try 
       {
            insert test; 
       } 
       catch (system.Dmlexception e) 
       {
            system.debug (e);
       }
    }

Is creation of custom object possible with apex and metadata API?

 

Help me plz

 

Regards,

S.Sivakumar

I have custom object Opportunity_CRM__c. Once i upload the data into it i have to create another custom object test__c automatically with employee_id__c as one field.?(i.e dynamically i have to create the custom object) can any one give me the logic to implement this?

 

regards,

S.sivakumar

Is it possible to access the overall backend database of standard objects of an organization from apex class?If possible,explain me with an example.

 

For your kind information i am using developer edition in force platform.

 

Its urgent.Please help me.

 

Regards,

S.Sivakumar

Is it possible to create custom objects from apex class dynamically (i.e) during runtime?If it is possible,explain me the steps with an example?

Its urgent.Please help me.

 

regards

S.Sivakumar

Hi, im new to force platform.i have to clarify some doubts.so please help me.

I have two custom objects Opportunity_CRM__c and test__c. Lets consider Opportunity_CRM__c takes the following values,

 

opportunity ID          Employee ID       Amount

        1                                 1                        920

        2                                 1                        400

        3                                 1                        300

        4                                 2                        600

 

 


I have two fields in test__c namely Emploee_Id__c and Totot_count_opportunities__c. I have to populate the custom object test__c with following values,

 

Employee ID              Total Count Opportunities

         1                                     3

         2                                     1

 

i.e. i have to find the total number of opportunities with respect to each employee.

 

My Apex class,

global class opportunity 
{
    global static void totaloppcnt(Opportunity_CRM__c[] op)
    {
            try{
            String eid;
            Integer tcount;
            test__c var = new test__c();
            for (Opportunity_CRM__c w :op)
            {    
                List<AggregateResult> groupedResults = [SELECT Employee_ID__c,COUNT(Amount__c)tntcnt FROM Opportunity_CRM__c GROUP BY Employee_ID__c];
                for (AggregateResult ar : groupedResults) 
                {
                    eid = (String)ar.get('Employee_ID__c');
                    tcount = (Integer)ar.get('tntcnt');
                    var.Employee_ID__c = eid;
                    var.Total_Opp_Cnt__c = tcount;
                    insert var;
                }
            }
            }
            catch(DmlException e) {}
    
      }
}

Initially i gat System.DmlException: Insert failed. First exception on row 0 with id a0R90000002Hg2wEAC; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]..so i used try and catch to overcome that error.After that insert operation is successfully done but im not getting the desired results.

 

My Apex trigger,

trigger oppcnttrigger on Opportunity_CRM__c (after insert,after update) 
{
    Opportunity_CRM__c[] p = Trigger.new;
    opportunity.totaloppcnt(p);
}

Please help me..its urgent..