• Asit
  • NEWBIE
  • 0 Points
  • Member since 2012

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

Hi,

I have followling UI :-

 

   Brand Bonding / Segmentation Filter

Brand--None--  BBL--None-- 
Brand Segment--None-- 
 

I can translate all the outputLabels with Japanese characters.

However, the BBL picklist values still come in English. How can I translate the picklist values??

I have provided the snippet below for this particular section. Your help will highly appreciated.

 

VF--

 

<apex:pageBlockSectionItem id="pbitembbl">
<apex:outputLabel value="{!$Label.lbl_CallScheduling_BBL}" for="bbl"></apex:outputLabel>

<apex:selectList id="bbl" value="{!bblval}" title="BBL" size="1">
<apex:selectOptions value="{!BBLS}"></apex:selectOptions>         // PICKLIST VALUES OF BBL
</apex:selectList>

</apex:pageBlockSectionItem>

 

 

APEX--

 


public List<SelectOption> getBBLS()
{
List<SelectOption> options = new List<SelectOption>();

Schema.DescribeFieldResult fieldResult =
Customer_Brand__c.BBL_Override1__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
options.add(new SelectOption('','--None--'));
for( Schema.PicklistEntry f : ple)
{
options.add(new SelectOption(f.getLabel(), f.getValue()));
}
return options;
}

  • February 14, 2013
  • Like
  • 0

Below is my test class.. though it is covering around 77% , still i am unable to resolve this error.

 

Message:-

System.LimitException: Too many SOQL queries: 101

 

 

Stack Trace:-

Trigger.UpdatePrimaryAccount: line 79, column 1

 

 

UpdatePrimaryAccount: Line 79:-

 Map<id,Account> personAccounts = new Map<id,Account>([Select Id, name, BillingStreet, BillingCity, BillingCountry, BillingPostalCode, PersonContactId, Person_Account_Brick_Name__c, Primary_Customer__pc, has_primary__pc from Account where PersonContactId in:locationContactId]);

 

My Test Class:-

 

@isTest
private class callReportCloneButtonTest{


 public static testMethod void callReportCloneButton(){ 

        Test.startTest();
               
        testUtils x = new testUtils();
        x.setupMasterData(); 
        List<Event> eventsToInsert1 = new List<Event>();
    eventsToInsert1.add(new Event(Subject = 'NewTestEvent', 
                        whoId = x.testCon.id, 
                        whatId = x.testAcc.id, 
                        DurationInMinutes = 30, 
                        ActivityDateTime = datetime.now()));
    insert eventsToInsert1;
    List<Call_Report__c> cr=[Select Id, duration__c from Call_Report__c where contact__c = :x.testCon.id];   
               
        Apexpages.Currentpage().getParameters().put('baId',x.testAcc.id);    
        Apexpages.Currentpage().getParameters().put('cont',x.testCon.id); 
        Apexpages.Currentpage().getParameters().put('crId',cr.get(0).Id);   
        Apexpages.Currentpage().getParameters().put('crRT','Call'); 
        Apexpages.Currentpage().getParameters().put('dt','16/11/2012 06:30'); 

          ApexPages.StandardController sc = new ApexPages.standardController(cr.get(0));
          callReportCloneButton crcb = new callReportCloneButton (sc);
          crcb.ct = x.testCon;
          crcb.getContactDetails();
          System.debug('hcpRecList ==> '+crcb.hcpRecList);
          for(callReportCloneButton.hcpRecordClass hrc:crcb.hcpRecList){
              hrc.blnHCPSelected=true;   
          }
          crcb.sel1=true;
          crcb.lname1='Test LName';
          crcb.phone1='90909099';
          crcb.job1='Dentist';
          
          crcb.sel2=true;
          crcb.lname2='Test LName1';
          crcb.phone2='90909099';
          crcb.job2='Dentist';
          
          crcb.sel3=true;
          crcb.lname3='Test LName2';
          crcb.phone3='90909099';
          crcb.job3='Dentist';
          
          crcb.insertHCP();
          Test.stopTest();
          
            
}
}

 

 

 

 

  • November 22, 2012
  • Like
  • 0

Hello,

 

I am a novice developer. It would be really helpful if anyone can help me with the Test Class.

I am unable to reach the required coverage!!

 

 

my apex class---

 

 

public class callReportCloneButton
{

 

/*-- All the required declarations */


public callReportCloneButton(ApexPages.StandardController controller)
{
accid= Apexpages.currentpage().getParameters().get('baId');
HCPid= Apexpages.currentpage().getParameters().get('cont');
dateTym= Apexpages.currentpage().getParameters().get('dt');
crID = Apexpages.currentpage().getParameters().get('crID');

getContactDetails();
}


//Returning The List Of HCP details related to the particular Bussiness Account for the respective clone button clicked.

public void getContactDetails()
{

listAccnt=[SELECT Id,FirstName,LastName,Job_Title__c,phone,Primary_Customer__c,Primary_Customer__r.name,BA_Address__c,X1st_Specialty__c FROM Contact WHERE Primary_Customer__c=:accid ORDER BY Job_Title__c] ;

hcpRecList=new List<hcpRecordClass>();

for (Contact a:listAccnt){
hcpRecordClass hrc=new hcpRecordClass();
hrc.cId = a.Id;
hrc.cFirstName = a.FirstName;
hrc.cLastName = a.LastName;
hrc.jobTitle = a.Job_Title__c;
hrc.cphn = a.phone;
hrc.pAccount = a.Primary_Customer__r.name;
hrc.cAddress = a.BA_Address__c;
hrc.primarySpclty = a.X1st_Specialty__c;
String cmpstr = String.valueOf(hrc.cId).substring(0,15);

if (cmpstr.trim() == HCPid.trim()){
hrc.blnHCPSelected = true;
}else{
hrc.blnHCPSelected = false;
}
hcpRecList.add(hrc);

}

}

//Create new HCP and create Event for the list of selected HCPs.

public PageReference insertHCP()
{
list<Account> instacc = new list<Account>();
list<Event> evntlist = new list<Event>();
Set<id> accids = new Set<id>();
Set<id> idsss = new Set<id>();


//Creating a Temporary List of Inner Class type to capture the selection among present list of HCPs.

hcpRecTemp=new List<hcpRecordClass>();
List<Event> evtList=new List<Event>();
for (hcpRecordClass hr:hcpRecList){

String cmpstr = String.valueOf(hr.cId).substring(0,15);
if (hr.blnHCPSelected == true && cmpstr.trim() != HCPid.trim()){
Event e=new Event();
e.Type__c='Call';
e.Call_Type__c='Face To Face';
e.WhoId = hr.cId;
e.StartDateTime = DateTime.parse(dateTym);
e.EndDateTime = DateTime.parse(dateTym);
evtList.add(e);
}
if(hr.blnHCPSelected == false && cmpstr.trim() == HCPid.trim())
{
check = true;
}

}
insert evtList; // Creating Events for the list of selected HCPs.



listRecordTyp = [select id from RecordType where sobjectType='Account' and developerName='personaccount']; // Fetching the Person Account (Record Type) that needed to be added to the account


if (sel1 == true)
{
// Creating Person Account (HCP) as per the selection in the bottom of the VF Page
Account acc = new Account();
acc.firstname = fname1;
acc.lastname = lname1;
acc.Job_Title__pc= job1;
acc.Has_a_computer__pc = comp1;
acc.X1st_Specialty__pc = sjob1;
acc.phone = phone1;
acc.PersonHasOptedOutOfEmail = true;
acc.Primary_Customer__pc = string.valueof(accid);
acc.recordtypeid = listRecordTyp.get(0).id; // '012200000009w7B';
//insert acc;
instacc.add(acc);
}

if(sel2 == true)
{
Account acc = new Account();
acc.firstname = fname2;
acc.lastname = lname2;
acc.Job_Title__pc= job2;
acc.Has_a_computer__pc = comp2;
acc.X1st_Specialty__pc = sjob2;
acc.phone = phone2;
acc.PersonHasOptedOutOfEmail = true;
acc.Primary_Customer__pc = String.valueOf(accid);
acc.recordtypeid = listRecordTyp.get(0).id;
instacc.add(acc);
}

if(sel3 == true)
{
Account acc = new Account();
acc.firstname = fname3;
acc.lastname = lname3;
acc.Job_Title__pc= job3;
acc.Has_a_computer__pc = comp3;
acc.X1st_Specialty__pc = sjob3;
acc.phone = phone3;
acc.PersonHasOptedOutOfEmail = true;
acc.Primary_Customer__pc = String.valueOf(accid);
acc.recordtypeid = listRecordTyp.get(0).id;
instacc.add(acc);
}
// Author: Asit Mishra
// @ Mahindra Satyam
//Creating Event for each of the added HCPs above
if(instacc.size()>0)
{
insert instacc;
for(account ac:instacc)
{
accids.add(ac.id);
}
if(accids.size()>0)
{
accList = [SELECT personContactId FROM Account WHERE id in: accids];
if(accList.size()>0)
{
for(account tempacc:accList)
{
Event e=new Event();
e.Type__c='Call';
e.Call_Type__c='Face To Face';
e.WhoId = tempacc.personContactId;
e.StartDateTime = DateTime.parse(dateTym);
e.EndDateTime = DateTime.parse(dateTym);
evntlist.add(e);
}
insert evntlist;
}
}
}


if(check == true) // Deleting Call Report of the dafault HCP is unselected.
{
set<id> eveids = new set<id>();
list<Call_Report__c> ccc =[select id from Call_Report__c where id =:crID];
if(ccc.size()>0)
{
for(Call_Report__c calobj:ccc)
{
eveids.add(calobj.id);
}

delete ccc;
}
if(eveids.size()>0)
{
List<Event> delevnt = [SELECT Id FROM Event WHERE Call_Report_Id__c =:eveids];
if(delevnt.size()>0)
delete delevnt;
}

}

datetime dt = datetime.parse(dateTym);
String doy = String.valueOf(dt.dayOfYear());
String yr = dateTym.substring(6,10);
PageReference reference=new PageReference('/00U/c?md0='+yr+'&md3='+doy);
reference.setRedirect(true);
return reference;
}

public Contact ct{
get{
if (ct == null) {
ct = new Contact ();
}
return ct ;
}
set;

}
public Call_Report__c cr {
get{
if (cr == null) {
cr = new Call_Report__c();
}
return cr ;
}
set;
}

// Inner Classes
public class hcpRecordClass {
public String cId {get;set;}
public boolean blnHCPSelected {get;set;}
public String cFirstName {get;set;}
public String cLastName {get;set;}
public String jobTitle {get;set;}
public String cphn {get;set;}
public String pAccount {get;set;}
public String cAddress {get;set;}
public String primarySpclty {get;set;}
}

}

  • November 02, 2012
  • Like
  • 0

Hello,

 

Please suggest how can I direct to Calender  It is redirecting inside my current popup visual force page. 

I need to CLOSE the current pop up VF page and redirect the page to CALENDAR from where the button was clicked.

here is my code.. Please suggest what should I do? Also is it ok if I am hardcoding the calendar url?

 

VF---

 

<apex:commandButton value="Submit" action="{!insertHCP}"  onclick="insertval();" styleClass="buttonStyle" />

 

Apex--

 

 

Public PageReference insertHCP(){

<--My other logic-->

PageReference reference=new PageReference('/00U/c?cType=1&md3=286&md0=2012');
reference.setRedirect(true);
return reference;

}



  • October 24, 2012
  • Like
  • 0

I am a novice apex programmer and new to triggers. Please suggest me how can I write a trigger to fetch a value from Child__c object having a field named "No_of_child_count__c" and populate the same calue in Parent__c object having a field named "Count_parent__c".

We just need to update the parent field after insertion of new records in child object.

 

  • September 25, 2012
  • Like
  • 0

I can successfully send messages from salesforce to any user account on facebook(Facebook Toolkit).

And on replying to those send messages it comes to my facebook account which is ok.

However I cant recollect the messages from facebook to a salesforce object.

Please suggest how can I accomplish this?

 

Regards

Asit

 

  • July 25, 2012
  • Like
  • 0

Hello!

 

Can anyone suggest how can we post a message on a private page or can send any message to someone who is not in our friend's list?? Posting on my own wall is possible but how can we do it on some other page??

 

Regards

Asit

  • July 19, 2012
  • Like
  • 0

Using facebook toolkit, I can successfully post any thing on my own wall in facebook from my salesforce account.

But is it possible to post something onto a page or some other's account? 

How can this integration be done?

 

Pls help!

 

Regards,

Asit

  • July 16, 2012
  • Like
  • 0

Hello,

 


  • July 12, 2012
  • Like
  • 0

Hello,

 

The scenario is something like whenever a user "Jr. Executive" tries to delete a record of an object ,it cannot be deleted unless this action is approved by the "Manager" above in the hierarchy. I have tried this by the help  of  a dummy status field but was unable to execute it succesfully.

 

Please help me out!!

 

Regards

 

Asit Mishra

  • June 18, 2012
  • Like
  • 0

Below is my test class.. though it is covering around 77% , still i am unable to resolve this error.

 

Message:-

System.LimitException: Too many SOQL queries: 101

 

 

Stack Trace:-

Trigger.UpdatePrimaryAccount: line 79, column 1

 

 

UpdatePrimaryAccount: Line 79:-

 Map<id,Account> personAccounts = new Map<id,Account>([Select Id, name, BillingStreet, BillingCity, BillingCountry, BillingPostalCode, PersonContactId, Person_Account_Brick_Name__c, Primary_Customer__pc, has_primary__pc from Account where PersonContactId in:locationContactId]);

 

My Test Class:-

 

@isTest
private class callReportCloneButtonTest{


 public static testMethod void callReportCloneButton(){ 

        Test.startTest();
               
        testUtils x = new testUtils();
        x.setupMasterData(); 
        List<Event> eventsToInsert1 = new List<Event>();
    eventsToInsert1.add(new Event(Subject = 'NewTestEvent', 
                        whoId = x.testCon.id, 
                        whatId = x.testAcc.id, 
                        DurationInMinutes = 30, 
                        ActivityDateTime = datetime.now()));
    insert eventsToInsert1;
    List<Call_Report__c> cr=[Select Id, duration__c from Call_Report__c where contact__c = :x.testCon.id];   
               
        Apexpages.Currentpage().getParameters().put('baId',x.testAcc.id);    
        Apexpages.Currentpage().getParameters().put('cont',x.testCon.id); 
        Apexpages.Currentpage().getParameters().put('crId',cr.get(0).Id);   
        Apexpages.Currentpage().getParameters().put('crRT','Call'); 
        Apexpages.Currentpage().getParameters().put('dt','16/11/2012 06:30'); 

          ApexPages.StandardController sc = new ApexPages.standardController(cr.get(0));
          callReportCloneButton crcb = new callReportCloneButton (sc);
          crcb.ct = x.testCon;
          crcb.getContactDetails();
          System.debug('hcpRecList ==> '+crcb.hcpRecList);
          for(callReportCloneButton.hcpRecordClass hrc:crcb.hcpRecList){
              hrc.blnHCPSelected=true;   
          }
          crcb.sel1=true;
          crcb.lname1='Test LName';
          crcb.phone1='90909099';
          crcb.job1='Dentist';
          
          crcb.sel2=true;
          crcb.lname2='Test LName1';
          crcb.phone2='90909099';
          crcb.job2='Dentist';
          
          crcb.sel3=true;
          crcb.lname3='Test LName2';
          crcb.phone3='90909099';
          crcb.job3='Dentist';
          
          crcb.insertHCP();
          Test.stopTest();
          
            
}
}

 

 

 

 

  • November 22, 2012
  • Like
  • 0

Hello,

 


  • July 12, 2012
  • Like
  • 0

Hello,

 

The scenario is something like whenever a user "Jr. Executive" tries to delete a record of an object ,it cannot be deleted unless this action is approved by the "Manager" above in the hierarchy. I have tried this by the help  of  a dummy status field but was unable to execute it succesfully.

 

Please help me out!!

 

Regards

 

Asit Mishra

  • June 18, 2012
  • Like
  • 0