• Vijay@sfdc
  • NEWBIE
  • 140 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 18
    Replies
Hello All,

 
class Sample 
{
     string var1

      public void testmethod()
   {
         string var2;
   }
}

Sample  obj = new Sample ();

 obj.testmethod();
  obj.var1= 1;

how to Access give data to var2 ?
 obj.var2= 'Test data var2';

 
Hello All,

 can any one tel me how to write below code using Map
trigger MyHelloWorld on Account (before insert ,before update) {
  
        list<account> acc= trigger.new
           for(account a: acc)
        {
            if(a.Hello__c != 'hello' )
            a.Hello__c  ='Hello';
        }


}
Thanks

 
Hello All,
public class AccRatingUpdate
{
    list<account> acclist=[select id, name , rating from account];
    for(account acc: acclist)
    {
      
        
    }
}

kindly help me with the above code and its error
 
Hello All,
i have created test record  in test class, after i created record
for(account acc: alist)
{
  system.debug( '@@@@'+acc.recordtype.name); this values is null
system.debug( '$$$$'+acc.ischecked);  // this values true
 if(acc.recordtype.name=='Sample record type' & acc.ischecked==true)
  {
   // logic 
  //
 }
 in test class
 i have created record
 ex:
 testmethod ()
{
account acc= new acc( recordtypeid=// sme logic to fetch id
                                         name='ssssss' ,ischecked = true)
   insert  acc
}

with the above code i cant cover the condition  acc.recordtype.name=='Sample record type' , but data was inserted properly,

kindly tel me how to fix the above issue. please take it urgent.

thanks advance to all



 
Hello everyone,
 can any one explain how to play with bellow map , how its usful in developement . can you provide proper example with below map.

Map<String,Map<String,List<String>>> mapOfMaps = new Map<String,Map<String,List<String>>>();

Thanks to all  advance :)
Hello everyone,

Can any one explain me,  how to avoid below loop inside loop using map , can any one explain if i would write bellow code, will it get Hit by governer limits. Thanks Advance. 
 
for(String acct : acc)
    {
        List<String> contlist = new List<String>();
        for(Contact c : trigger.new)
        {
            if(acct == c.AccountId)
            contlist.add(c.id);   
        }
       
    }

Thanks 
 
Hello Everyone,

could you provide me soluction for displaying relationship data, in the below code debug statement always displaying NULL( in line number 17)
@istest  
public class testdatafactory {
    public static List<account > accountRecords(Integer num) {
        List < account > AccList = new List < account > ();
        for (Integer i = 0; i < num; i++)
        {
            account Acc = new account ();
            Acc.name = 'Account Testdata '+ i;
            Acc.BillingCity = 'chennai';
            Acc.BillingCountry = 'India';
            Acc.BillingPostalCode = '6000003';
            Acc.BillingState = 'tamilnadu';
            Acc.BillingStreet = 'West street';
            AccList.add(Acc);
        }
        insert AccList;
        return AccList;
    }
    public static List<contact > contactRecords(Integer num,list<account> acc) {
        List < contact > AccList = new List < contact > ();
        for (Integer i = 0; i < num; i++)
        {
            contact c = new contact ();
             c.LastName= ' Last Name'+i;
            c.accountID=acc[i].id;
            AccList.add(c);
            
        }
        insert AccList;
        return AccList;
    }
}

@istest
public class TestClass {
  static testmethod void Unittest()
    {
         list<account> acc= testdatafactory.accountRecords(10);
        //list<account> acclist=[select name,BillingCity from account];
         list<contact> con= testdatafactory.contactRecords(10,acc);
        
         
        for(contact c:con)
         {
             system.debug('===>'+c.account.name);
         }
 }

Thanks
Vijay
Hello Everyone,

advance Thanks,  i have issue with bellow iteration in code, could any help to fix the below code snippet

for(Ientry__c ie:Entry)
        {
            integer i=0;
            system.debug('ingeger==>>> '+i);
            ie.Incentive_Actual__c=Incentiveactual[i].id;
            if( i==1) ie.Appointmenttype__c='appointment';
                else
                if(i==2) ie.Appointmenype__c='sale';
                else
                if(i==3)ie.Appointmenttype__c='status';
                else
            ie.Appointment_incentive_type__c='lead';
    
            i=i+1;
        }
in the above code i value is not increasing , its being always "ZERO",

can any one help me to fix the above code
Hello all,
  Can any one help with creating utility Class in detail, with that i have to handle the record types also.
 I have basic idea about creating TestdataUtility class, i did not understand how to implement it.

 i have around five objects, recordtypes, and relationships  EX: A==B, A==>D,E  like that i have relaion ship ,

kindly suggest me the best way to create Testutility

Thanks 


  
Hello ,
can any one help me  write below code using Map. i am really not understanding how to plan program in map , can any one help me how to plan program in map instead of lists, i have aware of all map functions,
your help  is appreciable

trigger AccountInsert on Account (before insert,before update) {
  for(account acc:trigger.new)
    {
        list<account> myaccount =[select id, name from account where name=:acc.name];
        if(myaccount.size() >0 )
        {
            acc.name.adderror('account name already existed');
           acc.adderror('account name already existed!!!');
        }
    }
/*
    //using map
    list<account> acclist= new list<account>();
    map<id,name> Mapofnames= new map<id,name>();
    */
    
   
}
 
Hello All,
 
  can any one help me with writting the bellow code 
1) by using Map
2) with best pracitces 

trigger UpdatePhone1 on contact (After insert) {
    list<account> acc= new list<account>();
    
    for(contact con:trigger.new)
    {
        account a= [select id, name,phone from account where id=: con.accountid];
        a.phone= con.phone;
        acc.add(a);
    }
    update acc;

}
Hello All,


Public Class AccountCreation
{
Public List<Account> CreateAccount(String s, String p){
List<Account> a = new List<Account>();
for(Account acc:a)
{
acc.Name=s;
acc.phone=p;
insert all;
}
return a;
}

In the above programm , can crete account , but i am not getting rerun values after i executed bellow code in developer console
AccountCreation ac= new AccountCreation();
ac.CreateAccount('sss','1234');
System.debug("debug"+ ac);
in this debug statement not displaying any created records.
would any one please explain bit more what might be the reason .
 
Hello All,
map<id, account> am= new map<id,account>([select id,name from account limit 10 ]);
system.debug('ammm===>'+am)
 i have executed this code script , its working fine , but i tryied to executed bellow code i am getting error , please help me
what is the issue
map<name, account> am= new map<name,account>([select id,name from account limit 10 ]);
system.debug('ammm===>'+am);

Kindly help me with my doubt

Thanks :)

Hello all, 
  please help me to display indiviusal elements from loop

List<List<integer>> mainlist = new List<List<integer>>
{
    new List<integer>{1, 1, 9},
    new List<integer>{1, 2, 0},
    new List<integer>{1, 3, 6},
    new List<integer>{1, 4, 5, 2}
};
    
    system.debug('mainlist'+ mainlist);

   for(integer i=0;i<mainlist.size();i++)
   {
       system.debug('==>>'+mainlist.get(i));// with tihs i can loop all ((1, 1, 9), (1, 2, 0), (1, 3, 6), (1, 4, 5, 2))
       for(integer j)
                      // how to wirte code to display indivisual elements 
   }

Thanks
 
Hello All,
   i have gone through list and map, would any one share same example using LIST and MAP using 2 object. i am still confused when do i use list and when do i use map? please give me one common example , how MAP reduces code over LIST ?

Thanks,
 
Hello All,

   I am new to salesforce developement. could you please help me good in salesforce programming. i am really more hungry to learn programming. your advice will be appreciable.
  Thanks to all advance.

Thanks
SFDC Biggner
Hello All,
i have created test record  in test class, after i created record
for(account acc: alist)
{
  system.debug( '@@@@'+acc.recordtype.name); this values is null
system.debug( '$$$$'+acc.ischecked);  // this values true
 if(acc.recordtype.name=='Sample record type' & acc.ischecked==true)
  {
   // logic 
  //
 }
 in test class
 i have created record
 ex:
 testmethod ()
{
account acc= new acc( recordtypeid=// sme logic to fetch id
                                         name='ssssss' ,ischecked = true)
   insert  acc
}

with the above code i cant cover the condition  acc.recordtype.name=='Sample record type' , but data was inserted properly,

kindly tel me how to fix the above issue. please take it urgent.

thanks advance to all



 
Hello everyone,
 can any one explain how to play with bellow map , how its usful in developement . can you provide proper example with below map.

Map<String,Map<String,List<String>>> mapOfMaps = new Map<String,Map<String,List<String>>>();

Thanks to all  advance :)
Hello everyone,

Can any one explain me,  how to avoid below loop inside loop using map , can any one explain if i would write bellow code, will it get Hit by governer limits. Thanks Advance. 
 
for(String acct : acc)
    {
        List<String> contlist = new List<String>();
        for(Contact c : trigger.new)
        {
            if(acct == c.AccountId)
            contlist.add(c.id);   
        }
       
    }

Thanks 
 
Hello Everyone,

advance Thanks,  i have issue with bellow iteration in code, could any help to fix the below code snippet

for(Ientry__c ie:Entry)
        {
            integer i=0;
            system.debug('ingeger==>>> '+i);
            ie.Incentive_Actual__c=Incentiveactual[i].id;
            if( i==1) ie.Appointmenttype__c='appointment';
                else
                if(i==2) ie.Appointmenype__c='sale';
                else
                if(i==3)ie.Appointmenttype__c='status';
                else
            ie.Appointment_incentive_type__c='lead';
    
            i=i+1;
        }
in the above code i value is not increasing , its being always "ZERO",

can any one help me to fix the above code
Hello ,
can any one help me  write below code using Map. i am really not understanding how to plan program in map , can any one help me how to plan program in map instead of lists, i have aware of all map functions,
your help  is appreciable

trigger AccountInsert on Account (before insert,before update) {
  for(account acc:trigger.new)
    {
        list<account> myaccount =[select id, name from account where name=:acc.name];
        if(myaccount.size() >0 )
        {
            acc.name.adderror('account name already existed');
           acc.adderror('account name already existed!!!');
        }
    }
/*
    //using map
    list<account> acclist= new list<account>();
    map<id,name> Mapofnames= new map<id,name>();
    */
    
   
}
 
Hello All,
 
  can any one help me with writting the bellow code 
1) by using Map
2) with best pracitces 

trigger UpdatePhone1 on contact (After insert) {
    list<account> acc= new list<account>();
    
    for(contact con:trigger.new)
    {
        account a= [select id, name,phone from account where id=: con.accountid];
        a.phone= con.phone;
        acc.add(a);
    }
    update acc;

}
Hello All,


Public Class AccountCreation
{
Public List<Account> CreateAccount(String s, String p){
List<Account> a = new List<Account>();
for(Account acc:a)
{
acc.Name=s;
acc.phone=p;
insert all;
}
return a;
}

In the above programm , can crete account , but i am not getting rerun values after i executed bellow code in developer console
AccountCreation ac= new AccountCreation();
ac.CreateAccount('sss','1234');
System.debug("debug"+ ac);
in this debug statement not displaying any created records.
would any one please explain bit more what might be the reason .
 
Hello All,
map<id, account> am= new map<id,account>([select id,name from account limit 10 ]);
system.debug('ammm===>'+am)
 i have executed this code script , its working fine , but i tryied to executed bellow code i am getting error , please help me
what is the issue
map<name, account> am= new map<name,account>([select id,name from account limit 10 ]);
system.debug('ammm===>'+am);

Kindly help me with my doubt

Thanks :)

Hello all, 
  please help me to display indiviusal elements from loop

List<List<integer>> mainlist = new List<List<integer>>
{
    new List<integer>{1, 1, 9},
    new List<integer>{1, 2, 0},
    new List<integer>{1, 3, 6},
    new List<integer>{1, 4, 5, 2}
};
    
    system.debug('mainlist'+ mainlist);

   for(integer i=0;i<mainlist.size();i++)
   {
       system.debug('==>>'+mainlist.get(i));// with tihs i can loop all ((1, 1, 9), (1, 2, 0), (1, 3, 6), (1, 4, 5, 2))
       for(integer j)
                      // how to wirte code to display indivisual elements 
   }

Thanks
 
Hello All,
   i have gone through list and map, would any one share same example using LIST and MAP using 2 object. i am still confused when do i use list and when do i use map? please give me one common example , how MAP reduces code over LIST ?

Thanks,
 
Hello All,

   I am new to salesforce developement. could you please help me good in salesforce programming. i am really more hungry to learn programming. your advice will be appreciable.
  Thanks to all advance.

Thanks
SFDC Biggner