• pavan501
  • NEWBIE
  • 65 Points
  • Member since 2016
  • Software Engineer
  • Techmahindra


  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 7
    Replies
Hi All,

i want to pass value if the checkbox is clicked.The below code is i am used

Visualforcepage

<apex:inputCheckbox value="{!isallbranch}" onchange="checkSelectedValue" selected ="true"/> All Branch
<apex:inputCheckbox value="{!isallbranch}" onchange="checkSelectedValue" /> Branch1

Apex

Public boolean isallbranch{get;set;} 
Public boolean myvalue{get;set;}
Public boolean myvalue1{get;set;}

public string checkSelectedValue(){ 
     if(!isallbranch == true)       
        System.debug('isallbranch value----- is true');   
        myvalue = "test";
       return myvalue;
    } 
       
    public PageReference pageLoad() {
     myvalue1 = checkSelectedValue();
     for(myobi__c mynobj :[ select field1__c,field2__c from myobj__c WHERE field1 = myvalue1] )
     { }
    }

is this possible or is there any alternative is available.give me a solution as soon as possible

Thank you..
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.NullPointerException: Attempt to de-reference a null object

my code is :

public class AccountHandler {

    public static Account insertNewAccount (String accName){
        
        
    if(accName!=''){    
        try{
            Account a = new Account(Name=accName);
            insert a;
            System.debug(' Account created');
            return a;
        } catch(Exception e){
            System.Debug('Account not created');
            return null;
        }
    } else {
        return null;
    }
     
        
    }    
}
//Class//
public with sharing class lifecycle{

private final Account acct;
Integer EmpAdd;

Public lifecycle(MYControllernew controller) {
this.acct = (Account)controller.getAccount();
}

public String getGreeting(){
return acct.name + ' Current Information';
}

public void resetEmp() {
acct.numberofemployees = 10;
update acct;


}
}

//testclass//

@istest
public class lifecycletest{

public static testmethod void testvalidate(){

Account acc=new Account ();
acc.Name='Testing';
insert acc;


test.starttest();

//ApexPages.StandardController MYControllernew= new ApexPages.StandardController(acc);
//lifecycle mec = new lifecycle(MYControllernew controller);
//ApexPages.currentPage().getParameters().put('id',acc.id);
        
//mec.getGreeting();
//mec.resetEmp();


test.stoptest();



}

My testclass is not covering the above class.Am getting error regarding standard controller.
Please help.
Hi All,

i want to pass value if the checkbox is clicked.The below code is i am used

Visualforcepage

<apex:inputCheckbox value="{!isallbranch}" onchange="checkSelectedValue" selected ="true"/> All Branch
<apex:inputCheckbox value="{!isallbranch}" onchange="checkSelectedValue" /> Branch1

Apex

Public boolean isallbranch{get;set;} 
Public boolean myvalue{get;set;}
Public boolean myvalue1{get;set;}

public string checkSelectedValue(){ 
     if(!isallbranch == true)       
        System.debug('isallbranch value----- is true');   
        myvalue = "test";
       return myvalue;
    } 
       
    public PageReference pageLoad() {
     myvalue1 = checkSelectedValue();
     for(myobi__c mynobj :[ select field1__c,field2__c from myobj__c WHERE field1 = myvalue1] )
     { }
    }

is this possible or is there any alternative is available.give me a solution as soon as possible

Thank you..
Session_Date__c, Level__c FROM Session__c
                               ^
ERROR at Row:1:Column:49
sObject type 'Session__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
Hi Team

I would like to know, how a checkbox field automatically uncheck based on some date criteria through workflow time trigger. Basically logic should be..

If date_field_c + 1=today() then field update happen (checkbox_field_c = unchecked)

I already implemented one workflow but it did not work well. I am mentioning my workflow logic below:-
RecordType.Name = "Field Staff" && ((End_Date__c + 1) = today())

Field update:-
New Field ValueFalse

Please let me know how I can resolve the issue.
Dear All,, can anyone ssuggest plz.
I have a custom object " Quotation" where there is a Driver details section with below fields,
User-added image
Now, I have a related object on Quotation object, which is a look up to the " Personal account " field. Below are the various test names of the drivers

User-added image
Each has an Age maintained in teh respective records. Now i need to select the minimum age from all these records and whoever has the min age, that name will reflect in the " Young driver" field with all other detailed fields.
when we keep on adding new records, it should recalculate and choose the latest min one. I tried to write the trigger, but got stuck, can anybody plz try to rectify my trigger, thnx
 
trigger trgYoungDriver on Quotation__c (after insert, after update, after delete) {
Set<Id> orgIds = new Set<Id>();
List< Account> updates = new List<Account>();
Quotation__c[] qot = null;

 if(Trigger.isInsert||Trigger.isUpdate)
    {
        qot = Trigger.new;
    }
    else if(Trigger.isDelete)
    {
        qot = Trigger.old;
    }
    
for(Quotation__c  q : [select id,
        min(Contact_Number__r.Age__c),Young_Driver__c,AgeYoungD__c from Quotation__c 
        where id IN :Trigger.new])
for(Quotation__c  p : [select id,
        min(Contact_Number__r.Age__c),Young_Driver__c,AgeYoungD__c from Quotation__c 
        where id IN :Trigger.old])
{
  
        updates.add(q.AgeYoungD__c)=q.Contact_Number__r.Age__c;
            
    }

update updates;


}


 
 
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.NullPointerException: Attempt to de-reference a null object

my code is :

public class AccountHandler {

    public static Account insertNewAccount (String accName){
        
        
    if(accName!=''){    
        try{
            Account a = new Account(Name=accName);
            insert a;
            System.debug(' Account created');
            return a;
        } catch(Exception e){
            System.Debug('Account not created');
            return null;
        }
    } else {
        return null;
    }
     
        
    }    
}