• krishna casukhela 7
  • NEWBIE
  • 204 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 61
    Questions
  • 59
    Replies
I have a simple page as follows. The user enters first name and selects country name from picklist and hits the save button, so values are saved
to backend.

How to convert this page so it can be used for multiple languages?

a user in china should see the page as per chinese lanuage. How to achieve this?

How to use custom settings OR custom labels, translation workbench or do I have to code?

can any one pls explian in detail with code ?

Thanks
krishna
 
I am having a piece of code which fetches countryname along with its code from custom setting
and populates the country name into the visual force page.

In custom setting, type=LIST , anme is Countries__c and it has a field called CountryCode__c.

if the user selects Australia from vf page and click SAVE button then 'CA' is stored in the backend and so on.
The values in custom settings are not very huge.

Now i need to have another picklsit in vf page , which will display the state name based on the country selected.

I want to store the states names also in custom settings(state names are not many just a few).

Here is what I have achieved so far.
 
public List<SelectOption> CountryCodeList=new List<SelectOption>();

public String selectedCountryCode {get; set;}

 public  List<SelectOption> getCountryCodes() 
   {
        if(countryCodeList.isEmpty())
        {
           countryCodeList=new List<SelectOption>();
           List<Countries__c> allCountries = new List<Countries__c>();

           allCountries = [SELECT  Name,CountryCode__c
                                  FROM    Countries__c];

             
          allCountries.sort();
          
List<Countries__c> cList=new List<Countries__c>([select CountryCode__c 
                                                        from Countries__c 
                                                        where CountryCode__c=:selectedCountryCode]);
          
          if (cList.size() > 0)
          {
          
            for(Countries__c country : allCountries )
            {
              
                countryCodeList.add( new SelectOption( country.CountryCode__c, country.Name ) );
            }
          }
          else
          {
             countryCodeList.add(new SelectOption('--Select--', '--Select--'));

          }
       } 
     
        return countryCodeList;
   }
   
   

<apex:selectOption itemValue=" " itemLabel="--Select--"></apex:selectOption>
<apex:selectOptions value="{!countryCodes}"></apex:selectOptions>
</apex:selectList>

Please let me know how to capture value of first picklsit and based on that get the states for that country.
also how to design the custom setting so as to include the states and how to use changes in vf page.

I request the forum members to help me out urgently.

Thanks
krishna
 
Hello
I need to disable the command button in the visual force page.
I have a piece of logic which fetch data into an custom object called subscription__c.

The subscription object has a field called Mailing_List_Name__c.

IN the URL I will append a value , based on this it fetches the data.

If the Mailing_List_Name__c is empty then I want to disable the command button in visual force page.
 
public List<Subscription__c> subs;

 public BusinessObjects__c tlBU;  

 public void loadSubscriptions() {
      
  subs = [SELECT Id, Name, Active__c, Mailing_List_ID__c, Mailing_List_Name__c, Fan_ID__c, Promo_ID__c, Mailing_List_ID__r.TLA_ID__c, 
                       Mailing_List_ID__r.Territory__c 
                       FROM Subscription__c 
                       WHERE Fan_Id__c =:fan.Id];             
                
        //---------**** Territory Id & Territory Name of the Business Unit ****-----------
     try
     {
        tlBU=[select ID,Name
                     from BusinessObjects__c
                     where 
                      MID__c=:ApexPages.currentpage().getparameters().get('mid')];
      
        TerritoryCheck=tlBU.Name;

}

vf page

  <label><apex:inputCheckbox value="{!s.selection}"/></label>
                                                                 
  <apex:commandButton value="SAVE CHANGES" action="{!btn_subscription_saveChanges}" reRender="outPanelSub"/>
Please let me know how to achieve this.

Thanks
krishna

 
I have a country picklist in visualforce page and the country names are stored in a custom setting(countries__c), under this I created a field called countrycode__c.
If I select India then in object 'IN'  gets stored.

so in visual force page I am fetching country names
 
public class CountryCodeGeneratorController {

    public List<SelectOption> countryNames { get; set; }

     

    public CountryCodeGeneratorController() {

        getCountryNames();
    }

    public void getCountryNames() {

        countryNames = new List<SelectOption>();

        List<Countries__c> allCountries = new List<Countries__c>();

        allCountries = [

            SELECT  Name,CountryCode__c
                    FROM    Countries__c
        ];

        for( Countries__c country : allCountries ) {

            countryNames.add( new SelectOption( country.Id, country.Name ) );

        }}

Now in visual force page I create another picklsit say states and what I want to achieve is for every country selected I want to fetch the corresponding states. I do not think its required to create a picklist in object design. also where to store the state names. Please let me know how to achieve this.

Thanks
krishna
I have a custom object called fan__c which has an email field, data type=Email.
when the page loads I append an ID to the URL so thereby I fetch the email vlaue from fan__c.
Also I am masking the mail value, when the user clicks SAVE button, the page refresh and it will show only the masked value to the user.

I need to check for a couple of things but unfortunately I am not getting this straight.
a) I should show an error message if the email field is blank when the user clicks SAVE button
b) assume the email field value is subbu123@gmail.com  and I change it to  subbu123    @gmail.com  OR I give as   subbu123@  and click SAVE button then it should throw me the default email validation error but its not happening.
any urgent help will be appreciated.

I have given the complete code
public class Pref6 
{
        
    public String fanEmail { get; set; } 
    public String fan_email{get;set;}  
    public fan__c fan{get;set;}
}

 public Pref6()
 {
        encryptedfanID=ApexPages.currentpage().getparameters().get('id');
               
        if(String.isBlank(encryptedfanID))
        {
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Error: Invalid Id.');
                ApexPages.addMessage(myMsg);
                return;
        }
        else
        {
          try
          {
            fetchfanvalues();
          }
          catch(System.QueryException ex){
                
              Apexpages.addMessage(new Apexpages.Message(Apexpages.Severity.ERROR, 'No Record'));
          }
   
        }}

  public void fetchfanvalues()
    {
         fan = new fan__c();
         
         fan=[SELECT id,Email__c,
              FROM fan__c 
              WHERE Encrypted_ID__c=:encryptedfanID];
         
         if (fan != NULL)
         {
             if(!string.isBlank(fan.Email__c))
             {
                fan_email=fan.Email__c;
                fanEmail=maskEmail(fan.Email__c);
             }
   }

//Here I mask the email address so when the user clicks SAVE button the page will refresh and he can see only the //masked values

public string maskEmail(string address) {        
        system.debug('Email Mask Called');
        string beforeEmailAddress = address.substringBefore('@');        
        string afterEmailAddress = address.substringAfter('@');        
                
        if(beforeEmailAddress.contains('.')){
            
            string emailNameBeforeDot = beforeEmailAddress.substringBefore('.');            
            string emailNameAfterDot = beforeEmailAddress.substringAfter('.');            
            
            emailAddress = emailNameBeforeDot.substring(0,1);
            
            for(integer i=0; i<emailNameBeforeDot.length()-1; i++){
                emailAddress += '*';                
            }
            
            emailAddress += '.';
            emailAddress += emailNameAfterDot.substring(0,1);
            
            for(integer i=0; i<emailNameAfterDot.length()-1; i++){
                emailAddress += '*';                
            }
            
            emailAddress += '@';            
            
        }else{
            
            emailAddress = beforeEmailAddress.substring(0,1);
            
            for(integer i=0; i<beforeEmailAddress.length()-1; i++){
                emailAddress += '*';                
            }
            
            emailAddress += +'@';
        }   
        
        if(afterEmailAddress.contains('.')) {
        
            string beforeEAddress = afterEmailAddress.substringBefore('.');
            string afterEAddress = afterEmailAddress.substringAfter('.');
            
            string eAddress = beforeEAddress.substring(0,1);
            
            for(integer i=0; i<beforeEAddress.length()-1; i++){
                
                eAddress += '*';
            }
            
            eAddress += '.' +afterEAddress;
            
            emailAddress += eAddress;        
        }
        return emailAddress;
    }
    
public void LoadMaskedValues()
   {
       fan = new fan__c();
       
       if (fan != NULL)
       {
      
           fan=[SELECT id, Email__c,Mobile_Phone__c
                       FROM fan__c 
                       WHERE Encrypted_ID__c=:encryptedfanID];
                       
           if(!string.isBlank(fan.Email__c))
           {
                fan_email=fan.Email__c;
                fanEmail=maskEmail(fan.Email__c);
           }
   }

public void SaveValues()
{
     if (fan != NULL)
      {
            
      if (string.isBlank(fanEmail))
      {
         ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Email Cannot Be Blank.');
         ApexPages.addMessage(myMsg);
      }  
      else
      {
      if (fanEmail.equals(maskEmail(fanEmail)))
      {
         if (string.isBlank(fan_Email))
         
         fan.Email__c=fan_Email;  //user hits save button without making any changes
      }
      else
      {
         integer count=[select count() from fan__c where Email__c=:fanEmail];
        
         if (count > 0)
         {
           
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'This Fan Already Exists In The System.');
            ApexPages.addMessage(myMsg);
            return;
         }
         else
         {
            fan.Email__c=fanEmail;  //with changes.
         }
      }
      try
      {
         upsert fan;
      }
      catch(System.DmlException ex)
      {
            
        Apexpages.addMessage(new Apexpages.Message(Apexpages.Severity.ERROR, 'Cannot Update the Record.. '+ex.getMessage()));
      }

    LoadMaskedValues();     
}

visual force page:
=================
 <apex:inputText value="{!fanEmail}" styleClass="form-control required"/>
  <apex:commandButton value="SAVE CHANGES" action="{!btn_profile_saveChanges}" styleClass="btn btn-success"/>

Thanks
krishna
Hi
I have  created a custom setting whose api name is SonyMusicUK__c and added value to it as       Sony Music UK
Now in my soql I want to refer to this custom setting but I am unable to do so

SonyMusicUK__c p;  //create an object for custom setting
p=[select Name from SonyMusicUK__c];
system.debug(p);
List<subscription__c> lstsub=new List<subscription__c>();
lstsub=[select s.Mailing_List_Name__c
                               from subscription__c s
                               where s.Territory_ID__c.Territory__c LIKE (p)];
system.debug(lstsub);
system.debug(lstsub.size());

I am not getting desired result, any better way of doing this.

thanks
krishna
Hello
I have like this in my visualforce page
<apex:page controller="somename">

<apex:form>
<apex:inputHiddenField value="{!firstname}" id="hiddenfield">
<apex:inputText value="{!firstName}" id="fname" onchange="GetFirstName(this);"  />

<apex:commandButton value="Save" action="{!SaveChanges}"/>
</apex:form>
<script type="text/javascript">
  function GetFirstName(data)
  {
      var hiddenvalue=document.getElementByID('data').value;
      alert(hiddenfield);  // am getting the correct value in alert
 }
</script>
</apex:page>
Now what I require is to have value of javascript variable(hiddenvalue) in my apex controller.
I want to do some action when I click the button so inside button code I need to have the value of javascript variable.
I hope I am clear.
without using action function or apex:param is there a way to do this?

pls let me know, urgent.

thanks
krishna
Hello
I have a piece of code where as soon as the visual force page loads I mask the email id .
for ex: if emailID is jose@gmail.com, it is masked as  j***@g****.com

But before storing the field value in sobject, I need to unmask it to jose@gmail.com

any help will be greatly appreciated.
private String maskEmail (String sEmail){

         String sMaskedEmail;

         String[] aEmail = sEmail.split('@');
         if(aEmail.size() == 2){

             sMaskedEmail = aEmail[0].left(1);

             for(integer i=0; i < aEmail[0].length() - 1; i++){

                 sMaskedEmail += '*';

             }
              

             String[] aEmail2 = aEmail[1].split('\\.', 2);

             sMaskedEmail += '@' + aEmail2[0].left(1);

             for(integer i=0; i < aEmail2[0].length() - 1; i++){

                 sMaskedEmail += '*';

             }

             sMaskedEmail += '.' + aEmail2[1];
         }

         return sMaskedEmail;  

    }

thanks
krishna
 
Hello
I have an visual force page purely designed using HTML5 responsive.
It has three tabs , profile TAB, Preferences TAB and Subscriptions TAB.

so in UI i have three custom objects i.e profile , preferences and subscriptions.

each TAB has some set of fields to enter along with apex command button to saves changes to respective sobject.

When I am working in Profile TAB, when I click SAVE button,control remains in the Profile TAB for me to review my changes.
When I am working in Preferences TAB, when I click SAVE button,control does not remain in the Preferences TAB for me to review my changes and it goes back to the Profile TAB.
similarly it happens for subscription tab, control goes back to Profile TAB when I click SAVE button in subscription TAB.
Please let me know if there is a way to prevent this.

A piece of HTML code along with apex controls is shown.
<apex:page controller="PrefCenterCTRL" docType="html-5.0">
<head>
    <meta charset="utf-8" />
    
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

    <title>Preferences</title>

    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<apex:stylesheet value="{!URLFOR($Resource.bootstap)}"/>
    <apex:stylesheet value="{!URLFOR($Resource.materialkit)}"/>

</head>

<body>

    <div class="wrapper">   

            <div class="form-container">
                <div class="card">
<apex:image id="SonyLogo" value="{!$Resource.MyImage}" alt="" styleClass="img-circle"/>
                        <p>Hi, {!fanFirstName}</p>
                        <p>Edit your details &amp; hit "Save Changes" to update </p>
                        <apex:pageMessages ></apex:pageMessages>

 <apex:form >
                    <!--<form class="form" method="" action="">-->
                        <div class="content" style="clear:both">
                            <div class="preferences">
                                <ul  class="nav nav-pills">
                                    <li class="active"><a  href="#1a" data-toggle="tab">Profile</a></li>
                                    <li><a href="#2a" data-toggle="tab">Preferences</a></li>
                                    <li><a href="#3a" data-toggle="tab">subscriptions</a></li>
                                </ul>
                                <div class="tab-content clearfix">
                                    <div class="tab-pane active" id="1a">
                                        <div class="white-block"> 
                                            <h4>HOW SHOULD WE CONTACT YOU?</h4>
                                            <div class="form-group label-floating">
                                                <label class="control-label">EMAIL *</label>
                                                <apex:inputText value="{!fanEmail}" styleClass="form-control"/>
                                                <!-- <input type="email" class="form-control"/> -->
                                            </div>
</div>

</apex:form>
</apex:page>
I hope I am clear.

Thanks
krishna
 
Hello 
I have a custom object fan which has three fields, email , firstname and lastname , email field being mandatory.
first time when page  loads, I append an ID known as encryptedfanID to the browser URL , thereby it loads the respective values into the fields.
so this part is working fine
suppose if I do not append any ID to the URL and hit the save button without entering any values then it throws error " ateempt to deference a null object" error.
 
public class PrefCenterCTRL{
02
 
03
    //Profile Tab 
04
     public String fanLastName { get; set; }
05
    public String fanFirstName { get; set; }
06
    public String fanEmail { get; set; }    
07
    public String encryptedfanID{get;set;}
08
    public fan__c fan{get;set;}
09
    
10
public PrefCenterCTRL()
11
    {
12
     try
13
     {
14
        encryptedfanID=ApexPages.currentpage().getparameters().get('id');
15
        system.debug('@@@'+encryptedfanID);
16
         
17
        if(String.isBlank(ApexPages.currentPage().getParameters().get('id')))
18
        {
19
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Error: Invalid Id.');
20
                ApexPages.addMessage(myMsg);
21
                return;
22
        }
23
        else
24
        {
25
           
26
          fetchfanvalues();
27
        }
28
         
29
      }
30
      catch(Exception e){
31
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,e.getMessage());
32
            ApexPages.addMessage(myMsg);
33
            return;
34
      }   
35
    }
36
 
37
 public void fetchfanvalues()
38
    {
39
    try
40
    {
41
       fan=[SELECT id, Email__c,First_Name__c,Last_Name__c,
42
            FROM fan__c
43
           WHERE Encrypted_ID__c=:encryptedfanID];
44
             
45
       
46
       if(!string.isBlank(fan.Email__c))
47
       {
48
            fan_email=fan.Email__c;
49
       }
50
 
51
       if(!string.isBlank(fan.First_Name__c))
52
       {
53
           fanFirstName=fan.First_Name__c;
54
       }
55
        
56
       if(!string.isBlank(fan.Last_Name__c))
57
       {
58
           fanLastName=fan.Last_Name__c;
59
       }
60
  }
61
 
62
 public void SaveValues()
63
    {
64
                
65
      if(!string.isBlank(fan_email))
66
      {
67
       fan.Email__c=fan_email;
68
      }
69
       
70
      if(!string.isBlank(fanMobile))
71
      {
72
        fan.Mobile_Phone__c=fanMobile;
73
      }
74
       
75
      if(!string.isBlank(fanFirstName))
76
      {
77
         fan.First_Name__c=fanFirstName;
78
    }
79
    public PageReference btn_profile_saveChanges()
80
    {
81
        SaveValues();
82
        return null;
83
    }
84
}
85
 
86
<apex:page controller="PrefCenterCTRL"
87
           docType="html-5.0"
88
           showHeader="false" >
89
 
90
<apex:form>
91
 
92
         <apex:inputText value="{!fanEmail}" id="email_val"/>    
93
         <apex:inputText value="{!fanfirstname}" id="firstname"/> 
94
         <apex:inputText value="{!fanLastName}" id="lastname"/>
95
<apex:commandButton value="SAVE CHANGES"
96
                    action="{!btn_profile_saveChanges}" />
97
<apex:form>
98
</apex:page>
Please help me out.

Thanks
Krishna
 
Hello
I have three html tabs in my visualforce page.
The page has been designed using HTML5 responsive.

Tab1:
name
age
salary

Tab2:
height
weight

Tab3:
temperature
country(assume its picklist)

After the user will enter all field values in Tab1, only then the progress bar should show Green color on 100% , same is the case in Tab2 and Tab3.

Please let me know the best efficient way to implement this.

Thanks
Krishna
Hello friends
I am appending a contact ID to the browser url, based on the contact ID I will fetch lastname and leadsource into the vf page for that contact ID only.

so I am trying to bind leadsource picklist values into my controller as follows for that particular contact ID only.
public class clsContact {
    public Contact contact {get; set;}
    public String lastname{get; set;}
    public List<Selectoption> leadsourcevalues{get; set;}
    String contactId {get; set;} 
   
    public clsContact(){
        contactId = ApexPages.currentPage().getParameters().get('id');
        if(contactId != null)
        {
           getContact();
        }
        else{
            contact = new Contact();
        }
 }
public void getContact() {
            contact = [SELECT Id, lastname,LeadSourcee FROM Contact WHERE Id = :contactId];
 }

<apex:page controller="clsContact" >
<apex:form >
 <apex:inputField value="{!contact.FirstName}"/>
 //Here how to get the picklist value for that particular ID
  <apex:commandButton value="Save" action="{!save}"/>
</apex:form>
</apex:page>
I am struggling here so kindly help me out.
Thanks
krishna


 
Hello friends
I have a zip file say HTML5 which has three folders. i.e css , img and js .
I am using css , js and images in my visualforce page.

I saw few urls from salesforce where they say we can upload zipfile direclty in static resource.
But this isnt working when the page loads.

I am doing something like this

<apex:stylesheet value="{!URLFOR($Resource.HTML5, 'bootstrap-min.css')}"/>
But whatever combinations I try it does not work, same case with image and jquery files.

so what I did is to create a separate static resource for each file and then call in vf page , it works.

The vf page is designed using HTML5 responsive templates , HTML code. so is this preventing the styles from being applied?

Thanks
krishna
Please let me know why it isnt working.

 
Hello friends
I have a requirement as follows. I am explaining in detail.

I have a URL say https://ap2.salesforce.com?fanID=0032800000gufvJ  in salesforce.
based on this FanID I will get the email of that user.

Now I have a visualforce page with standard controller="fan__c"
<apex:inputText name="email>

In aex controller:
string fanid="Apexpages.currentpage().getparameter('fanID');
               if fanid != NULL
  string emaladdress=[select Email from fan__c where ID=:fanID];

Now value in emailaddress should be stored in <apex:InputText name=Email>

if the email already exists it should be replaced with asterisk as follows.
for example : assume email is  jose@gmail.com and if it exists for that particular ID then the contents of <apex:inputText> should be
j***@g****.com

If email doesnt exist for that  FanID   then contents of <apex:inputText> will contain   mary@yahoo.co.in

I am literaly struggling with this so any will be rewarded with points

thanks
krishna
Hello
I am having some trouble trying to understand actionsupport example.
public with sharing class PassParameterActionSupport 
{
    public String value_entered{get;set;}
    
    public String enteredText1{get;set;}

    public String enteredText2{get;set;}
    
    public void DisplayText()
    {
    
      value_entered=Apexpages.currentPage().getParameters().get('firstParam') + ' ' 
                    + Apexpages.currentPage().getParameters().get('secondParam');
    }
}

<apex:page controller="PassParameterActionSupport">

<apex:form id="frm">

<apex:outputPanel id="resultPanel">

Data entered is : <apex:outputLabel value="{!value_entered}"/>
                  
</apex:outputPanel>
<br/> <br/><br/>

Enter Text 1 :<apex:inputText id="txt1" />
<br />

Enter Text 2 : <apex:inputText id="txt2" />
<br/> <br/>
                 
<apex:actionSupport action="{!DisplayText}"
                    reRender="resultPanel"
                    event="onkeyup">
                     
    <apex:param  assignTo="{!enteredText1}" 
                 name="firstParam" 
                 value="" />
     
     <apex:param assignTo="{!enteredText2}"
                 name="secondParam"  
                 value="" />
   
  </apex:actionSupport>
  
</apex:form>

</apex:page>

I need to get the values of text1 and text2 and just display them.
any body please pinpoint where exactly I am going wrong.

Thanks
krishna

 
Hello
I have a visual force component with some business logic in it, this component I am calling inside an visual force page which has an controller associated with it. I want how to create a managed package for this , so any user can extract the package in his login and able to utilize my logic.

pls elaborate.

Thanks
Krishna
Hello friends
In an custom object, I have two fields , age & term & sum assured (it is a numeric fields)

Maximum value in term field = 10
first I want to bind a jquery slider in an visual force page to age field , so as we move the slider the value in age field changes

Then I need to bind a jquery slider in same visual force page for term field ,  so as we move the slider the value in term field also changes

Pls tell me how to do this , a small code snippet explaining the same would be grealty helpful to understand

finally there is a custom field called sum assured, here I will enter some value and then on button click I will save the record to sobject.

a small screen shot explaining what I actually want.
screen shot

thanks
krishna
Hello friends
I am trying to understand inner join , left outer , right outer , anti join on soql queries.
I have written two queries below, pleae let me know what type of joins they fall in, here's where I have confusion.

How to find all parent records with associated child records?
List<Account> accList=[select Account.Name,(select contact. Name from contacts)
                                   from Account
                                   where ID IN (select AccountID from Contact)];
 
I want to display those parent records who have orphaned children
List<Account> accList=[select ID, Name from Account
                                         where ID NOT IN (select AccountID from Opportunity
                                                                        where StageName='Closed Won')];

thanks
krishna
Hello
what are the various tools in sales process and marketing process.
I heard a tool called EXACT tool but how it actually works , in what scenario no idea.
if we are developing a project from scratch how to use this tools?

Thanks
krishna
Hello
I have a urgent requirement as follows.
There is historical data in account object , it has 2 million records.
Account object has two fields with same data type say shipcode and billcode and I need to compare values in these two fields.
I am thinking of batch apex but if the matching rows are say 1Lakh then I cannot store in a list variable.
somebody told me about formula field but I am not sure how to go about this.
The aim is to create a report by including the formula field, but I am assuming about 1Lakh matching can turn up,
Please advise , elaborate wherever possible

Thanks
Krishna

 
Hi Guys

I appearing for dev 401 cert next week.
For the following questions I see different ansers from many people and frankly speaking I don't have clue as what could be the correct answer
Kindly let me know.

1) Which of the following cannot be used on a user page layout?
Please select two choices.
a. Tag
b. Links
c. Buttons
d. Custom fields
e. Inline Visualforce

Ans: e (my answer is 'e' but I am not sure)

2.Which two (2) items most closely relate to the controller layer of the model view controller paradigm?

a. Apex classes
b. Apex extensions
c. Custom tab
d. Page Layout

My answer : c,d  But I am not sure

3. In a profile can we revoke sharing permisisons:?

My answer : YES  but not very sure

4.  Which of the following statements are true about Roles? (Select all that apply.)
A. A user may be associated with multiple Roles.
B. A user must be associated with at least one Role.
C. Roles do not need to follow the organization chart.
D. Roles control how records roll up for reporting.
E. Roles control the level of visibility that users have to an organizations data.

My answer :  C,D,E but kindly clarify

5)  Under what circumstances would the sharing button to be enabled on a detail view for a record.

A. A developer has added the button to the page layout 

B. When record sharing is enabled in the user profile 

C. When record sharing is set to public read only or private for the object 

D. When record sharing is set to public read/write for the object 


6) What elements does a custom object automatically contain when it is created? (Select all that apply.)

A.    Field Sets
B.    Queues
C.    Page Layout
D.    Standard Controller
E.    Record Type

My Answer : A,C,E  (but pls clarify)

Regards
Krishna Casukhela



 
I have a simple page as follows. The user enters first name and selects country name from picklist and hits the save button, so values are saved
to backend.

How to convert this page so it can be used for multiple languages?

a user in china should see the page as per chinese lanuage. How to achieve this?

How to use custom settings OR custom labels, translation workbench or do I have to code?

can any one pls explian in detail with code ?

Thanks
krishna
 
I am having a piece of code which fetches countryname along with its code from custom setting
and populates the country name into the visual force page.

In custom setting, type=LIST , anme is Countries__c and it has a field called CountryCode__c.

if the user selects Australia from vf page and click SAVE button then 'CA' is stored in the backend and so on.
The values in custom settings are not very huge.

Now i need to have another picklsit in vf page , which will display the state name based on the country selected.

I want to store the states names also in custom settings(state names are not many just a few).

Here is what I have achieved so far.
 
public List<SelectOption> CountryCodeList=new List<SelectOption>();

public String selectedCountryCode {get; set;}

 public  List<SelectOption> getCountryCodes() 
   {
        if(countryCodeList.isEmpty())
        {
           countryCodeList=new List<SelectOption>();
           List<Countries__c> allCountries = new List<Countries__c>();

           allCountries = [SELECT  Name,CountryCode__c
                                  FROM    Countries__c];

             
          allCountries.sort();
          
List<Countries__c> cList=new List<Countries__c>([select CountryCode__c 
                                                        from Countries__c 
                                                        where CountryCode__c=:selectedCountryCode]);
          
          if (cList.size() > 0)
          {
          
            for(Countries__c country : allCountries )
            {
              
                countryCodeList.add( new SelectOption( country.CountryCode__c, country.Name ) );
            }
          }
          else
          {
             countryCodeList.add(new SelectOption('--Select--', '--Select--'));

          }
       } 
     
        return countryCodeList;
   }
   
   

<apex:selectOption itemValue=" " itemLabel="--Select--"></apex:selectOption>
<apex:selectOptions value="{!countryCodes}"></apex:selectOptions>
</apex:selectList>

Please let me know how to capture value of first picklsit and based on that get the states for that country.
also how to design the custom setting so as to include the states and how to use changes in vf page.

I request the forum members to help me out urgently.

Thanks
krishna
 
Hello
I need to disable the command button in the visual force page.
I have a piece of logic which fetch data into an custom object called subscription__c.

The subscription object has a field called Mailing_List_Name__c.

IN the URL I will append a value , based on this it fetches the data.

If the Mailing_List_Name__c is empty then I want to disable the command button in visual force page.
 
public List<Subscription__c> subs;

 public BusinessObjects__c tlBU;  

 public void loadSubscriptions() {
      
  subs = [SELECT Id, Name, Active__c, Mailing_List_ID__c, Mailing_List_Name__c, Fan_ID__c, Promo_ID__c, Mailing_List_ID__r.TLA_ID__c, 
                       Mailing_List_ID__r.Territory__c 
                       FROM Subscription__c 
                       WHERE Fan_Id__c =:fan.Id];             
                
        //---------**** Territory Id & Territory Name of the Business Unit ****-----------
     try
     {
        tlBU=[select ID,Name
                     from BusinessObjects__c
                     where 
                      MID__c=:ApexPages.currentpage().getparameters().get('mid')];
      
        TerritoryCheck=tlBU.Name;

}

vf page

  <label><apex:inputCheckbox value="{!s.selection}"/></label>
                                                                 
  <apex:commandButton value="SAVE CHANGES" action="{!btn_subscription_saveChanges}" reRender="outPanelSub"/>
Please let me know how to achieve this.

Thanks
krishna

 
Hi
I have  created a custom setting whose api name is SonyMusicUK__c and added value to it as       Sony Music UK
Now in my soql I want to refer to this custom setting but I am unable to do so

SonyMusicUK__c p;  //create an object for custom setting
p=[select Name from SonyMusicUK__c];
system.debug(p);
List<subscription__c> lstsub=new List<subscription__c>();
lstsub=[select s.Mailing_List_Name__c
                               from subscription__c s
                               where s.Territory_ID__c.Territory__c LIKE (p)];
system.debug(lstsub);
system.debug(lstsub.size());

I am not getting desired result, any better way of doing this.

thanks
krishna
Hello
I have like this in my visualforce page
<apex:page controller="somename">

<apex:form>
<apex:inputHiddenField value="{!firstname}" id="hiddenfield">
<apex:inputText value="{!firstName}" id="fname" onchange="GetFirstName(this);"  />

<apex:commandButton value="Save" action="{!SaveChanges}"/>
</apex:form>
<script type="text/javascript">
  function GetFirstName(data)
  {
      var hiddenvalue=document.getElementByID('data').value;
      alert(hiddenfield);  // am getting the correct value in alert
 }
</script>
</apex:page>
Now what I require is to have value of javascript variable(hiddenvalue) in my apex controller.
I want to do some action when I click the button so inside button code I need to have the value of javascript variable.
I hope I am clear.
without using action function or apex:param is there a way to do this?

pls let me know, urgent.

thanks
krishna
Hello
I have a piece of code where as soon as the visual force page loads I mask the email id .
for ex: if emailID is jose@gmail.com, it is masked as  j***@g****.com

But before storing the field value in sobject, I need to unmask it to jose@gmail.com

any help will be greatly appreciated.
private String maskEmail (String sEmail){

         String sMaskedEmail;

         String[] aEmail = sEmail.split('@');
         if(aEmail.size() == 2){

             sMaskedEmail = aEmail[0].left(1);

             for(integer i=0; i < aEmail[0].length() - 1; i++){

                 sMaskedEmail += '*';

             }
              

             String[] aEmail2 = aEmail[1].split('\\.', 2);

             sMaskedEmail += '@' + aEmail2[0].left(1);

             for(integer i=0; i < aEmail2[0].length() - 1; i++){

                 sMaskedEmail += '*';

             }

             sMaskedEmail += '.' + aEmail2[1];
         }

         return sMaskedEmail;  

    }

thanks
krishna
 
Hello friends
I am appending a contact ID to the browser url, based on the contact ID I will fetch lastname and leadsource into the vf page for that contact ID only.

so I am trying to bind leadsource picklist values into my controller as follows for that particular contact ID only.
public class clsContact {
    public Contact contact {get; set;}
    public String lastname{get; set;}
    public List<Selectoption> leadsourcevalues{get; set;}
    String contactId {get; set;} 
   
    public clsContact(){
        contactId = ApexPages.currentPage().getParameters().get('id');
        if(contactId != null)
        {
           getContact();
        }
        else{
            contact = new Contact();
        }
 }
public void getContact() {
            contact = [SELECT Id, lastname,LeadSourcee FROM Contact WHERE Id = :contactId];
 }

<apex:page controller="clsContact" >
<apex:form >
 <apex:inputField value="{!contact.FirstName}"/>
 //Here how to get the picklist value for that particular ID
  <apex:commandButton value="Save" action="{!save}"/>
</apex:form>
</apex:page>
I am struggling here so kindly help me out.
Thanks
krishna


 
Hello friends
I have a requirement as follows. I am explaining in detail.

I have a URL say https://ap2.salesforce.com?fanID=0032800000gufvJ  in salesforce.
based on this FanID I will get the email of that user.

Now I have a visualforce page with standard controller="fan__c"
<apex:inputText name="email>

In aex controller:
string fanid="Apexpages.currentpage().getparameter('fanID');
               if fanid != NULL
  string emaladdress=[select Email from fan__c where ID=:fanID];

Now value in emailaddress should be stored in <apex:InputText name=Email>

if the email already exists it should be replaced with asterisk as follows.
for example : assume email is  jose@gmail.com and if it exists for that particular ID then the contents of <apex:inputText> should be
j***@g****.com

If email doesnt exist for that  FanID   then contents of <apex:inputText> will contain   mary@yahoo.co.in

I am literaly struggling with this so any will be rewarded with points

thanks
krishna
Hello friends
I am trying to understand inner join , left outer , right outer , anti join on soql queries.
I have written two queries below, pleae let me know what type of joins they fall in, here's where I have confusion.

How to find all parent records with associated child records?
List<Account> accList=[select Account.Name,(select contact. Name from contacts)
                                   from Account
                                   where ID IN (select AccountID from Contact)];
 
I want to display those parent records who have orphaned children
List<Account> accList=[select ID, Name from Account
                                         where ID NOT IN (select AccountID from Opportunity
                                                                        where StageName='Closed Won')];

thanks
krishna