• mamidi mahesh
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 5
    Replies
hi all
iam new to salesforce.
when i get system.limitexception:too many soql queries in trigger, then i dont want to display this exception. i want to display my own error msg to the user. please any one explain how to achieve this.
Why do we have to create many to many relationship on master-detail and why cant we create many to many relationship on lookup relationship. 
please explain any one about this.
Hi all,
There are two objects A, B, i have taken one intermediate custom object Jobject (Junction object). I have created A to Jobject lookup reationship and B to Jobject lookup realationship. now my question is that is it many to many relationship. if it is not many to many relationship then why. and why cant we create many to many relationship using lookup relationship. please explain about it.
hi,
data loader default batch size is 200. one batch is considered as one transaction. so while iam updating 200 records 200th record id is not specified. iam getting 199 successes and one error that is as id is not specified. 199 records are being updated. now my question is batch size is 200 then we dont have problem with 199 records only we have problem with 200th record then total transaction should be failed.  even 199 records should not be processed. process should be rolledback. incase of why 199 records are being updated. please explain this
My visualforce pag:
<apex:page standardController="Candidate__c" extensions="MyController">
    <apex:form >
        <apex:pageBlock title="Survey Form">
            <apex:pageBlockSection title="Experience Details">
                <apex:pageBlockTable style="width:165%;vertical-align:left;" value="{!expList}" var="exp">
                    <apex:column headerValue="Company Name" >
                        <apex:outputText value="{!exp.Name}"/>
                    </apex:column>
                    <apex:column headerValue="Start Date" style="width:300px">
                        <apex:outputText value="{!exp.Start_Date__c}"/>
                    </apex:column>
                    <apex:column headerValue="End Date" style="width:300px" >
                        <apex:outputText value="{!exp.End_Date__c}"/>
                    </apex:column>
                    <apex:column headerValue="Salary" >
                        <apex:outputText value="{!exp.Salary__c }"/>
                    </apex:column>   
                    <apex:column headerValue="Document Submitted?" >
                        <!--<apex:outputText value="{!exp.Documents_Submitted__c}"/>-->
                        <apex:selectradio value="{!exp.Documents_Submitted__c}" >
                             <apex:selectoptions value="{!types}"></apex:selectoptions>
                        </apex:selectradio>
                    </apex:column>              
                </apex:pageBlockTable>            
            </apex:pageBlockSection>
            <apex:pageBlockButtons location="Bottom">
                <apex:commandButton value="Submit" action="{!submit}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>             
        </apex:pageBlock>
    </apex:form>
</apex:page>
My contoller class:
public class MyController{
public List<Experiance__c> expList {get; set;}
private final Candidate__c candRec;
public MyController(ApexPages.StandardController stdController){
this.candRec=(Candidate__c)stdController.getRecord();
expList = [SELECT Id, Name, Start_Date__c, End_Date__c, Salary__c, Documents_Submitted__c FROM Experiance__c WHERE Candidate__c =: candRec.Id];
}
public List<SelectOption> getTypes(){
        Schema.sObjectType sobject_type = Experiance__c.getSObjectType();
    
        Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
    
        Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
      
        List<Schema.PicklistEntry> pick_list_values = field_map.get('Documents_Submitted__c').getDescribe().getPickListValues();
    
        List<selectOption> options = new List<selectOption>();
    
        for (Schema.PicklistEntry a : pick_list_values) {
            options.add(new selectOption(a.getLabel(), a.getValue()));
        }
        return options;
    }
    
public void submit(){
//update candRec;
update expList;
}
}
please could any one explain each line in gettypes() method in controller class that what will happen ineternally when every statement is executed.
Schema.sObjectType sobject_type = Experiance__c.getSObjectType();
  •     what will happen internally while above line is being executed?
        Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
  •     what will happen internally while above line is being executed?
        Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
  •         what will happen internally while above line is being executed?   
        List<Schema.PicklistEntry> pick_list_values = field_map.get('Documents_Submitted__c').getDescribe().getPickListValues();
  •         what will happen internally while above line is being executed?

        List<selectOption> options = new List<selectOption>();
  •         what will happen internally while above line is being executed?
        for (Schema.PicklistEntry a : pick_list_values) {
  •         what will happen internally while above line is being executed?
            options.add(new selectOption(a.getLabel(), a.getValue()));
  •         what will happen internally while above line is being executed?
        }
        return options;
what is the sales cloud?
what is the service cloud?
what is the difference between them?
my requirement is that i have to get the one value from visualforce page and i have to set that value to instance variable. instance variable is 
public String sscradio;
my code is below

public class MyController{
public String sscradio;
private final Candidate__c candRec;
public MyController(ApexPages.StandardController stdController){

this.candRec=(Candidate__c)stdController.getRecord();
System.debug(' we are in mycontroller constructor');
}
public String getSscradio(){
System.debug(' we are in mycontroller getter method');
return sscradio;
}
public void setSscradio(String sscradio){
System.debug(' we are in mycontroller setter method');
this.sscradio=sscradio;
}
public void submit(){
if(sscradio=='Yes'){
candRec.SSC_Certificate_submitted__c='Yes';
}else{
candRec.SSC_Certificate_submitted__c='No';
}
System.debug(' we are in mycontroller submit()'); 
update candRec;
}


when i save the vf page object is creating for controller class Mycontroller. and after saving if i go and see the debug logs, first constructor is executed,after that getter method is executed. when we click on submit in vf page  then again getter method is being executed after that setter method is executed after that submit() is executed, after that again getter method is executed. why getter method is being executed many times for one instance variable.
vf page conde is below


<apex:page standardController="Candidate__c" extensions="MyController"> <apex:form > <apex:pageBlock title="Survey form"> <apex:pageBlockSection title="Certificate Details" columns="1"> <apex:selectRadio label="SSC Certificate Submitted?" value="{!sscradio}"> <apex:selectOption itemlabel="Yes" itemvalue="Yes"/> <apex:selectOption itemLabel="No" itemvalue="No"/> </apex:selectRadio> </apex:pageBlockSection> </apex:pageBlock> <apex:commandButton value="submit" action="{!submit}"/> </apex:form> </apex:page>
please could any one explain that why getter method is being executed many times for one instance variable.
my requirement is that i have to get the one value from visualforce page and i have to set that value to instance variable. instance variable is
public String sscradio;
my code is below

public class MyController{
public String sscradio;
private final Candidate__c candRec;
public MyController(ApexPages.StandardController stdController){

this.candRec=(Candidate__c)stdController.getRecord();
System.debug(' we are in mycontroller constructor');
}
public String getSscradio(){
System.debug(' we are in mycontroller getter method');
return sscradio;
}
public void setSscradio(String sscradio){
System.debug(' we are in mycontroller setter method');
this.sscradio=sscradio;
}
public void submit(){
if(sscradio=='Yes'){
candRec.SSC_Certificate_submitted__c='Yes';
}else{
candRec.SSC_Certificate_submitted__c='No';
}
System.debug(' we are in mycontroller submit()'); 
update candRec;
}


when i save the vf page object is creating for controller class Mycontroller. and after saving if i go and see the debug logs, first constructor is executed,after that getter method is executed. when we click on submit in vf page  then again getter method is being executed after that setter method is executed after that submit() is executed, after that again getter method is executed. why getter method is being executed many times for one instance variable.
vf page conde is below


<apex:page standardController="Candidate__c" extensions="MyController"> <apex:form > <apex:pageBlock title="Survey form"> <apex:pageBlockSection title="Certificate Details" columns="1"> <apex:selectRadio label="SSC Certificate Submitted?" value="{!sscradio}"> <apex:selectOption itemlabel="Yes" itemvalue="Yes"/> <apex:selectOption itemLabel="No" itemvalue="No"/> </apex:selectRadio> </apex:pageBlockSection> </apex:pageBlock> <apex:commandButton value="submit" action="{!submit}"/> </apex:form> </apex:page>
please could any one explain that why getter method is being executed many times for one instance variable.
    global class SampleIterableBatch implements Database.batchable<sObject>{

global Iterable start(Database.BatchableContext info){ 
    date todaydate=Date.today();
       todaydate=todaydate+1;
       String query='select id,Status__c from position__c where Status__c!=\'Closed\' and createddate<=:todaydate';
       return query;      
      }     
   global void execute(Database.BatchableContext info, List<position__c> scope){
       for(position__c posRec: scope){ 
         posRec.Status__c='Closed'; 
       } 
       database.update(scope,false); 
   }     
   global void finish(Database.BatchableContext info){     
   } 
}
Error: Compile Error: Type arguments must be supplied for parameterized type : Iterable<t> at line 3 column 8
I want to use return type as Iterable of start method, after writing select query how to return it, please helpe any one. I dont want to use querylocator instead of Iterable. by writing iterable as return type only i want to execute this code. 
global class ClosePosEveryDay implements database.Batchable<sObject>{
 global database.QueryLocator start(database.BatchableContext bc){
    String query;
    date todayDate=date.today();
    System.debug('Today Date------------->'+todayDate);
    System.debug('System Date------------->'+System.today());
    query='select id,Status__c from position__c where Status__c=\'Closed\' and createdDate<=:(todayDate)+1';
    System.debug('Query------------->'+query);
    return Database.getQueryLocator(query);
    }
    global void execute(database.BatchableContext bc, List<position__c> scope){
    System.debug('Scope------------->'+scope);
    for(position__c posRec:scope){
    posRec.Status__c='Closed';
   
    }
    Database.update(scope,false);
    }
    global void finish(database.BatchableContext bc){
    }
    }
i know we can  add 1 before writing query. but it should be written in query only.please give me valid answer for this. is it possible or not to add 1 to date type variable in soql query. please tell me.
global class ClosePosEveryDay implements database.Batchable<sObject>{
 global database.QueryLocator start(database.BatchableContext bc){
    String query;
    date todayDate=date.today();
    System.debug('Today Date------------->'+todayDate);
    System.debug('System Date------------->'+System.today());
    query='select id,Status__c from position__c where Status__c=\'Closed\' and createdDate<=:(todayDate)+1';
    System.debug('Query------------->'+query);
    return Database.getQueryLocator(query);
    }
    global void execute(database.BatchableContext bc, List<position__c> scope){
    System.debug('Scope------------->'+scope);
    for(position__c posRec:scope){
    posRec.Status__c='Closed';
   
    }
    Database.update(scope,false);
    }
    global void finish(database.BatchableContext bc){
    }
    }
please give me valid answer for this.
global class ClosePosEveryDay implements database.Batchable<sObject>{
 global database.QueryLocator start(database.BatchableContext bc){
    String query;
    date todayDate=date.today();
    System.debug('Today Date------------->'+todayDate);
    System.debug('System Date------------->'+System.today());
    query='select id,Status__c from position__c where Status__c=\'Closed\' and createdDate<=:todayDate'+'+1';
    System.debug('Query------------->'+query);
    return Database.getQueryLocator(query);
    }
    global void execute(database.BatchableContext bc, List<position__c> scope){
    System.debug('Scope------------->'+scope);
    for(position__c posRec:scope){
    posRec.Status__c='Closed';
   
    }
    Database.update(scope,false);
    }
    global void finish(database.BatchableContext bc){
    }
    }
in this above cod i want to add 1 to todayDate variable in that query only. this code throwing an error. pleas give me answer
what is the difference between namespace in salesforce and package in java
hi,
data loader default batch size is 200. one batch is considered as one transaction. so while iam updating 200 records 200th record id is not specified. iam getting 199 successes and one error that is as id is not specified. 199 records are being updated. now my question is batch size is 200 then we dont have problem with 199 records only we have problem with 200th record then total transaction should be failed.  even 199 records should not be processed. process should be rolledback. incase of why 199 records are being updated. please explain this
global class ClosePosEveryDay implements database.Batchable<sObject>{
 global database.QueryLocator start(database.BatchableContext bc){
    String query;
    date todayDate=date.today();
    System.debug('Today Date------------->'+todayDate);
    System.debug('System Date------------->'+System.today());
    query='select id,Status__c from position__c where Status__c=\'Closed\' and createdDate<=:(todayDate)+1';
    System.debug('Query------------->'+query);
    return Database.getQueryLocator(query);
    }
    global void execute(database.BatchableContext bc, List<position__c> scope){
    System.debug('Scope------------->'+scope);
    for(position__c posRec:scope){
    posRec.Status__c='Closed';
   
    }
    Database.update(scope,false);
    }
    global void finish(database.BatchableContext bc){
    }
    }
please give me valid answer for this.
global class ClosePosEveryDay implements database.Batchable<sObject>{
 global database.QueryLocator start(database.BatchableContext bc){
    String query;
    date todayDate=date.today();
    System.debug('Today Date------------->'+todayDate);
    System.debug('System Date------------->'+System.today());
    query='select id,Status__c from position__c where Status__c=\'Closed\' and createdDate<=:todayDate'+'+1';
    System.debug('Query------------->'+query);
    return Database.getQueryLocator(query);
    }
    global void execute(database.BatchableContext bc, List<position__c> scope){
    System.debug('Scope------------->'+scope);
    for(position__c posRec:scope){
    posRec.Status__c='Closed';
   
    }
    Database.update(scope,false);
    }
    global void finish(database.BatchableContext bc){
    }
    }
in this above cod i want to add 1 to todayDate variable in that query only. this code throwing an error. pleas give me answer
what is the difference between namespace in salesforce and package in java