• Jasi
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 6
    Replies

I created a vf page, but I want label of the checkboxes to the right of the field value. I am using apex:inputfield for these checkboxes and these are fields in salesforce. 

 

Also is there a way to get a pageblocksection to the center of the page? 

 

Please help. 

 

Thanks,

 

  • May 19, 2013
  • Like
  • 0

Hello guys,

 

I need to ask a quick question. I have to work on a requirement , where I need to remove three fields ( day, month  and year) and create a new date field. This new date field is going to get mapped to the three fields in a pdf ( day, month and year). My company is having dynamic visualforce page and they are using field sets. They also have conga composer for pdf. Can anyone give me some idea about how to map the new field, once I put it in the corresponding fieldset, to the fields in pdf. Thanks.

  • April 16, 2013
  • Like
  • 0

Hello guys,

 

I am writing a test class on a trigger and getting 100% code coverage. But I am not able to check the bulk trigger. Can anyone help me include bulk in this test class. Both my trigger and test class is given below. The trigger fetches the associated agency with the contest, and update the agency record with the contest id.

 

Trigger:

 

trigger Tgr_Contests_After on Contests__c (after insert, after update) {
    Map<ID, ID> mapContestAccount = new Map<ID, ID>();
        // get the information of the inserted contest records
        for(Contests__c contest:trigger.new){
            if(contest.agency__c != null){
                mapContestAccount.put(contest.agency__c, contest.id);               
            }
        }
    }
    // get the account information for the loaded contest records
    List<Account> lstAccount = [select contests__c from Account where id in: mapContestAccount.keySet() limit 10000];
    List<Account> lstAccToBeUpdated = new List<Account>();
    // iterate the accounts for updating the contest lookup
    for(Account acc : lstAccount){
        acc.Contests__c = mapContestAccount.get(acc.id);
        lstAccToBeUpdated.add(acc);
    }
    // check if the lstAccToBeUpdated is not empty
    if(!lstAccToBeUpdated.isEmpty()){
        update lstAccToBeUpdated;
    }
}

 

Test class :

 

@isTest(seeAllData=true)
private class Tgr_Contests_After_Test {

    static testMethod void myUnitTest() {
    
    Account acc=TestDataFactory.createtestaccount();  
    insert acc;    
acc= [Select Id from Account where Id = :acc.Id];

              // test data for contests
        Contests__c contest = TestDataFactory.createContest();
        contest.Agency__c = acc.id;

               insert contest;
acc= [Select Id,contests__c from Account where Id = :acc.Id];
contest= [Select Id,agency__c from Contests__c where Id = :contest.id];

        system.assertEquals(contest.id,acc.contests__c);
    }
}

  • April 07, 2013
  • Like
  • 0

I am trying to write a test class on the following trigger. I created an account and updated it by changin the prospect stage value and the trigger is called. But the deletion is not happening as I did not take care of the attachments. Can anyone please guide me..thanks in advance!!

 

 

 

 

trigger tgr_Account_After on Account (after insert, after update ){//before delete) {
     //Disable Switch for this trigger managed by Custom Setting
   if(TriggerSwitchSetting__c.getInstance('tgr_Account_After') != null
                && TriggerSwitchSetting__c.getInstance('tgr_Account_After').Disable__c ==true){
        return;    }
    // declare the variables
    set<id> setAccntid = new set<id>();
    set<id> setAAid = new set<id>();
    list<echosign_dev1__SIGN_Agreement__c> listAgreement = new list<echosign_dev1__SIGN_Agreement__c>();
    // prepare the set of Account for the matching criteria
    // call this code when Account is updated and the prospect stage changes and the value is "Cancelled Appointment"
    for(Account acc : trigger.new){
        if(trigger.isupdate && acc.Prospect_Stage_c__c != trigger.oldMap.get(acc.Id).Prospect_Stage_c__c && acc.Prospect_Stage_c__c == String_Constant__c.getInstance('Cancel_Appointment').String_Value__c){
            setAccntid.add(acc.id);
        }
    }
   
    // get the Drafted Agreement records for the Cancelled accounts
    if(!setAccntid.isEmpty()){
        for(New_Appoinment_pacakge__c AA:[select id, Account__c from New_Appoinment_pacakge__c where Account__c in: setAccntid]){
            setAAid.add(AA.id);
        }
        // get the Agreement records which are to be deleted
        for(echosign_dev1__SIGN_Agreement__c agreement:[select id, Agency_Agreement__c from echosign_dev1__SIGN_Agreement__c where Agency_Agreement__c in: setAAid]){
            listAgreement.add(agreement);
        }
        // check if the retrieved list is not empty
        if(!listAgreement.isEmpty())
            delete listAgreement;
    }

}

  • April 02, 2013
  • Like
  • 0

I created a vf page, but I want label of the checkboxes to the right of the field value. I am using apex:inputfield for these checkboxes and these are fields in salesforce. 

 

Also is there a way to get a pageblocksection to the center of the page? 

 

Please help. 

 

Thanks,

 

  • May 19, 2013
  • Like
  • 0

Hello guys,

 

I am writing a test class on a trigger and getting 100% code coverage. But I am not able to check the bulk trigger. Can anyone help me include bulk in this test class. Both my trigger and test class is given below. The trigger fetches the associated agency with the contest, and update the agency record with the contest id.

 

Trigger:

 

trigger Tgr_Contests_After on Contests__c (after insert, after update) {
    Map<ID, ID> mapContestAccount = new Map<ID, ID>();
        // get the information of the inserted contest records
        for(Contests__c contest:trigger.new){
            if(contest.agency__c != null){
                mapContestAccount.put(contest.agency__c, contest.id);               
            }
        }
    }
    // get the account information for the loaded contest records
    List<Account> lstAccount = [select contests__c from Account where id in: mapContestAccount.keySet() limit 10000];
    List<Account> lstAccToBeUpdated = new List<Account>();
    // iterate the accounts for updating the contest lookup
    for(Account acc : lstAccount){
        acc.Contests__c = mapContestAccount.get(acc.id);
        lstAccToBeUpdated.add(acc);
    }
    // check if the lstAccToBeUpdated is not empty
    if(!lstAccToBeUpdated.isEmpty()){
        update lstAccToBeUpdated;
    }
}

 

Test class :

 

@isTest(seeAllData=true)
private class Tgr_Contests_After_Test {

    static testMethod void myUnitTest() {
    
    Account acc=TestDataFactory.createtestaccount();  
    insert acc;    
acc= [Select Id from Account where Id = :acc.Id];

              // test data for contests
        Contests__c contest = TestDataFactory.createContest();
        contest.Agency__c = acc.id;

               insert contest;
acc= [Select Id,contests__c from Account where Id = :acc.Id];
contest= [Select Id,agency__c from Contests__c where Id = :contest.id];

        system.assertEquals(contest.id,acc.contests__c);
    }
}

  • April 07, 2013
  • Like
  • 0