• Manoj Dega
  • NEWBIE
  • 110 Points
  • Member since 2013
  • Salesforce Developer
  • Accenture


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 3
    Likes Given
  • 22
    Questions
  • 16
    Replies
Is this the right order of execution in Salesforce with these options? If not please suggest. Thanks
1. system validation rules
2. Executes all before trigger
3. Custom Validation Rule
4. Execute all after trigger
5.Execute assignment rule
6. Execute Auto response rule
7. Execute workflow rule
8. Execute escalation rules

 
Hi Team,

I am getting below issue while authorizing the Org. Can someone help on this?
User-added image
Thank you
Manoj
HI Everyone,

I have a confusion about Helper and Handler classes.
Can some please explain briefly what are those?

Thanks in advance
Hi Team, I need to encrypt email address in the apex.

Here is sample Java code. Pls, help me how to generate this?
 
String email = "jobs@example.com";
String api_secret = "your api secret key".getBytes(new Charset("UTF-8"));
byte[] keydata = new byte[16];
// get the first 16 bytes of the api secret
System.arraycopy(api_secret, 0, keydata, 0, keydata.length);
byte[] email_bytes = email.getBytes(Charsets.UTF_8);
// Create a SecretKeySpec using the shared api secret
SecretKeySpec key = SecretKeySpec(keydata, "AES");
// Encrypt the email
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
IvParameterSpec ivspec = new IvParameterSpec(new byte[]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
cipher.init(Cipher.ENCRYPT_MODE, key, ivspec);
byte[] email_encrypted = cipher.doFinal(email_bytes);
// convert encrypted email to hex
StringBuilder buf = new StringBuilder(email_encrypted.length * 2);
for (byte b : email_encrypted) {
    String hexDigits = Integer.toHexString((int) b & 0x00ff);
    if (hexDigits.length() == 1)
        buf.append('0');
    buf.append(hexDigits);
}
String encrypted_email = buf.toString();

When using Indeed Apply through email, you must encrypt the email to which Indeed sends the applications. Indeed expects the email to be encrypted using the AES algorithm with your 128-bit secret key. The cipher mode is CBC with PKCS5 padding. The initialization vector is 16 bytes of 00.
Using your secret key, generate a 128-bit secret key using the first 16 bytes.
Read the bytes of the plain-text email encoded in "UTF-8".
Encrypt the email using the AES algorithm and your 128-bit key. Be sure to use CBC mode and PKCS5 padding.
Convert the encrypted bytes to hex string.
Use this hex string as your data-indeed-apply-email attribute.

Thanks in advance 
Hi everyone,

I have implemeted extension for my managed class, how to write test class for that.

Thanks in advance.
Manoj
Hi Team,
I have a custom sControl and embedded that into Standard Page layout but it is not loading. Is there any settings to enable or what ? it is working for other clients.
Please advise.
Manoj

 
Hi Everyone,
How to write a trigger to on EmailMessage object to update Contact values.
Can anyone help on this?
Thank you
Hello,
SSN number format in Visualforce page using Jquery or Javascript to Mask all
characters with (XXX-XX-XXXX)

Can anyone help me on this?

Thank you.
Hi Folks,

When i try to share Dashboards to particular user. When i try to customize my home page in user i got this notifation.  "Please have your adminstaror enable at least one dashboard for you to view"

The follwing are screenshot for reference.

User-added image
Hi Folks,

I have a picklist Countries__c in that values
United States US,
United Kingdom UK,
India IN these are the picklist values.
Now My Scenario is I want to select United Kingdom UK it will be populated as UK in another Formula field.

Thanks in advance.

Can you Please Tell me how to make formula for this...?
 
Hi All,

Can you Please tell me how to achive these
 
New_Date__c //Custom Field
Activity_Date__c // Another Custom Field

 New_Date__c = (Activity date + 1 Year) - ( 3 Months + 7 Days)

Thanks in Advance
Hi All,

Can anyone share the code snippet of Dependent Picklist using Dynamic Apex

Regards
Hi All,

Can any one help me my search was not working properly

Controller:
public with sharing class ContactSearchController {
    // the soql without the order and limit
  private String soql {get;set;}
  // the collection of contacts to display
  public List<Contact> contacts {get;set;}
  // the current sort direction. defaults to asc
  public String sortDir {
    get  { if (sortDir == null) {  sortDir = 'asc'; } return sortDir;  }
    set;
  }
  // the current field to sort by. defaults to last name
  public String sortField {
    get  { if (sortField == null) {sortField = 'lastName'; } return sortField;  }
    set;
  }
  // format the soql for display on the visualforce page
  public String debugSoql {
    get { return soql + ' order by ' + sortField + ' ' + sortDir + ' limit 20'; }
    set;
  }
  // init the controller and display some sample data when the page loads
  public ContactSearchController() {
    soql = 'SELECT Name,Account.Name,Email,OtherCity,OtherCountry,OtherState,Phone FROM Contact where account.name != null';
    runQuery();
  }
  // toggles the sorting of query from asc<-->desc
  public void toggleSort() {
    // simply toggle the direction
    sortDir = sortDir.equals('asc') ? 'desc' : 'asc';
    // run the query again
    runQuery();
  }
  // runs the actual query
  public void runQuery() {

    try {
      contacts = Database.query(soql + ' order by ' + sortField + ' ' + sortDir + ' limit 20');
    } catch (Exception e) {
      ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Ooops!'));
    }

  }
  // runs the search with parameters passed via Javascript
  public PageReference runSearch() {

    String name = Apexpages.currentPage().getParameters().get('name');
    String AccountName = Apexpages.currentPage().getParameters().get('AccountName');
    String email = Apexpages.currentPage().getParameters().get('email');
    String city = Apexpages.currentPage().getParameters().get('city');
    String state = Apexpages.currentPage().getParameters().get('state');
    String country = Apexpages.currentPage().getParameters().get('country');
    String phone = Apexpages.currentPage().getParameters().get('phone');

    soql = 'SELECT Name,Account.Name,Email,OtherCity,OtherCountry,OtherState,Phone FROM Contact where name != null';
    
    if (!name.equals(''))
    soql += ' and name LIKE \''+String.escapeSingleQuotes(name)+'%\'';
    if (!AccountName.equals(''))
    soql += ' and Account.Name LIKE \''+String.escapeSingleQuotes(AccountName)+'%\'';
    if (!email.equals(''))
    soql += ' and Email LIKE \''+String.escapeSingleQuotes(email)+'%\'';
    if (!city.equals(''))
    soql += ' and OtherCity LIKE \''+String.escapeSingleQuotes(city)+'%\'';
    if (!state.equals(''))
    soql += ' and OtherState LIKE \''+String.escapeSingleQuotes(state)+'%\'';
    if (!country.equals(''))
    soql += ' and OtherCountry LIKE \''+String.escapeSingleQuotes(country)+'%\'';
    if (!phone.equals(''))
    soql += ' and Phone LIKE \''+String.escapeSingleQuotes(phone)+'%\'';

    // run the query again
    runQuery();
    
    return null;
  }
  // runs the search with parameters passed via Javascript
 /* public PageReference runSearch() {

    String Name = Apexpages.currentPage().getParameters().get('Name');
    String AccountName = Apexpages.currentPage().getParameters().get('AccountName');
    String email = Apexpages.currentPage().getParameters().get('email');
    String city = Apexpages.currentPage().getParameters().get('city');
    String state = Apexpages.currentPage().getParameters().get('state');
    String country = Apexpages.currentPage().getParameters().get('country');
    String phone = Apexpages.currentPage().getParameters().get('phone');

    soql = 'SELECT Name,Account.Name,Email,OtherCity,OtherCountry,OtherState,Phone FROM Contact where account.name != null';
    if (!Name.equals(''))
      soql += ' and name LIKE ''+String.escapeSingleQuotes(Name)+'%'';
    
    if (!accountName.equals(''))
      soql += ' and account.name LIKE ''+String.escapeSingleQuotes(accountName)+'%'';
      if (!email.equals(''))
      soql += ' and email LIKE ''+String.escapeSingleQuotes(email)+'%'';
      if (!city.equals(''))
      soql += ' and city LIKE ''+String.escapeSingleQuotes(city)+'%'';  
      if (!state.equals(''))
      soql += ' and state LIKE ''+String.escapeSingleQuotes(state)+'%'';
      if (!country.equals(''))
      soql += ' and country LIKE ''+String.escapeSingleQuotes(country)+'%'';
      if (!phone.equals(''))
      soql += ' and phone LIKE ''+String.escapeSingleQuotes(phone)+'%'';

    // run the query again
    runQuery();

    return null;
  }*/
}

Visualforce Page:
 
<apex:page controller="ContactSearchController" sidebar="false">

  <apex:form >
  <apex:pageMessages id="errors" />

  <apex:pageBlock title="Contact Search" mode="edit">

  <table width="100%" border="0">
  <tr>  
    <td width="200" valign="top">

      <apex:pageBlock title="Parameters" mode="edit" id="criteria">

      <script type="text/javascript">
      function doSearch() {
        searchServer(
          document.getElementById("Name").value,
          document.getElementById("accountName").value,
          document.getElementById("email").value,
          document.getElementById("city").value,
          document.getElementById("State").value,
          document.getElementById("Country").value,
          document.getElementById("phone").value
          );
      }
      </script> 

      <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors">
          <apex:param name="Name" value="" />
          <apex:param name="accountName" value="" />
          <apex:param name="email" value="" />
          <apex:param name="city" value="" />
          <apex:param name="state" value="" />
          <apex:param name="country" value="" />
          <apex:param name="phone" value="" />
      </apex:actionFunction>

      <table cellpadding="2" cellspacing="2">
      <tr>
        <td style="font-weight:bold;">Name<br/>
        <input type="text" id="firstName" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Office Name<br/>
        <input type="text" id="accountName" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Email<br/>
        <input type="text" id="email" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">City<br/>
        <input type="text" id="city" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">State<br/>
        <input type="text" id="state" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Country<br/>
        <input type="text" id="country" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Phone<br/>
        <input type="text" id="phone" onkeyup="doSearch();"/>
        </td>
      </tr>
      </table>

      </apex:pageBlock>

    </td>
    <td valign="top">

    <apex:pageBlock mode="edit" id="results">

        <apex:pageBlockTable value="{!contacts}" var="contact">

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.Name}"/>
            </apex:column>

            <!--<apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Last Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="lastName" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.lastName}"/>
            </apex:column>-->

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Office Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="account.name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.account.name}"/>
            </apex:column>

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Email" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Email" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.Email}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="City" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="City" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.OtherCity}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="State" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="State" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.OtherState}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Country" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="OtherCountry" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.OtherCountry}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Phone" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Phone" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.Phone}"/>
            </apex:column>

        </apex:pageBlockTable>

    </apex:pageBlock>

    </td>
  </tr>
  </table>

  <apex:pageBlock title="Debug - SOQL" id="debug">
      <apex:outputText value="{!debugSoql}" />           
  </apex:pageBlock>    

  </apex:pageBlock>

  </apex:form>

</apex:page>

Thanks in Advance
Hi Folks,
Please Help me.

I've Lookup Relationship to A-->B , B-->C and I Want to Map C-->A

Where A,B and C are sObjects

Thanks in Advance
Hi Guys,

Please Help me Where we can create Web-to-Lead in Sandbox or Production?

Regards,
Manu
Hi,
I Configured web-to-lead in my sandbox but not created leads from that.
<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: Please add the following <META> element to your page <HEAD>.      -->
<!--  If necessary, please modify the charset parameter to specify the        -->
<!--  character set of your HTML page.                                        -->
<!--  ----------------------------------------------------------------------  -->

<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: Please add the following <FORM> element to your page.             -->
<!--  ----------------------------------------------------------------------  -->

<form action="https://cs11.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">

<input type=hidden name="oid" value="00DXXXXXXXXXX">
<input type=hidden name="retURL" value="http://www.salesforce.com">

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: These fields are optional debugging elements. Please uncomment    -->
<!--  these lines if you wish to test in debug mode.                          -->
<!--  <input type="hidden" name="debug" value=1>                              -->
<!--  <input type="hidden" name="debugEmail"                                  -->
<!--  value="abc@xyz.com">                                        -->
<!--  ----------------------------------------------------------------------  -->

<label for="first_name">First Name</label><input  id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>

<label for="last_name">Last Name</label><input  id="last_name" maxlength="80" name="last_name" size="20" type="text" /><br>

<label for="phone">Phone</label><input  id="phone" maxlength="40" name="phone" size="20" type="text" /><br>

<label for="mobile">Phone 1</label><input  id="mobile" maxlength="40" name="mobile" size="20" type="text" /><br>

Street Address:<textarea  id="00Nd0000006efI5" name="00Nd0000006efI5" type="text" wrap="soft"></textarea><br>

City:<input  id="00Nd0000006efHA" maxlength="100" name="00Nd0000006efHA" size="20" type="text" /><br>

State:<input  id="00Nd0000006efI2" maxlength="100" name="00Nd0000006efI2" size="20" type="text" /><br>

<label for="zip">Zip</label><input  id="zip" maxlength="20" name="zip" size="20" type="text" /><br>


<input type="submit" name="submit">

</form>


Please help me

Thanks in Advance
Manoj
Please Help me. I Got this Error Message while Running Batch Class

Delete failed. First exception on row 0 with id 00P17000000OaUNEA0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AttachmentActions: execution of AfterDelete caused by: System.DmlException: Update failed. First exception on row 0 with id a0H17000000

Thanks in Advance, Manoj
I've a Custom Settings with Hierarchy, on that two fields Read__c, Unread__c.
integer i=10;
integer j=5;

query1='select id,name,is_read__c,(select id from Attachments where createddate < last_n_days :'+i+') from Account where is_read__C = false';

query2='select id,name,is_read__c,(select id from Attachments where createddate < last_n_days :'+j+') from Account  where is_read__C = true';

The Above Code Snippet Works Good. when we Use Custom Settings Value in not works.
AccountSetting__c acs =AccountSetting__c.getInstance();
integer i=integer.valueOf(acs.Read__c); //Read = 10
integer j=integer.valueOf(acs.Unread__c); //Unread = 20

query1='select id,name,is_read__c,(select id from Attachments where createddate < last_n_days :'+i+') from Account where is_read__C = false';
query2='select id,name,is_read__c,(select id from Attachments where createddate < last_n_days :'+j+') from Account where is_read__C = true';
Thanks in Advance
Hi All,
I'm Strucking on Here. When I Run my Test Class Its Fail.

Batch Class
global class DeleteAttachmentScheduleClass implements Schedulable{
    public String  accstr1;
    public String  accstr2;
    public list<Account> acclist1 { get; set; }
    public list<Account> acclist2 { get; set; }
    public list<Account> acclistall { get; set; }
    public Set<Id> setAttachmetIds{ get; set; }
    public String  query;    

    global void execute(SchedulableContext sc){   
         acclist1 = new list<Account>();
         acclist2 = new list<Account>();
         acclistall = new list<Account>();
	
	//Custom Settins
        AccountSetting__c ecs =AccountSetting__c.getInstance();
        integer read=integer.valueOf(ecs.Read__c); // Read__c = 10
        integer unread=integer.valueOf(ecs.Unread__c); //Unread__c = 20

        accstr1='select id,name,is_read__c,(select id from Attachments where createddate < last_n_days :'+unread+') from Account where is_read__C = false';
        accstr2='select id,name,is_read__c,(select id from Attachments where createddate < last_n_days :'+read+') from Account where is_read__C = true';
        
        acclist1 = database.query(accstr1);
        acclist2 = database.query(accstr2);
        acclistall.addall(acclist1);
        acclistall.addall(acclist2); 
        for (Account objAccount:acclistall) {
            if (objAccount.attachments != null && objAccount.attachments.size() > 0) {
                for (Attachment objAttachment:objAccount.attachments) {
                    setAttachmetIds.Add(objAttachment.Id);
                    
                }
            }
        }

        query = 'select id from attachment where id in :setAttachmetIds';
              
        list<Attachment> attlist = database.query(query);
        if(attlist != null){
          try{
                DeleteAttachmentsBatchClass delBatch = new DeleteAttachmentsBatchClass(query);
                Id BatchProcessId = Database.ExecuteBatch(delBatch);
          }catch(Exception e){
                
          }
        }    
    }
}

Test Class
@isTest
public class TestDeleteAttachmentSchedule {
    public static String CRON_EXP = '0 0 0 15 3 ? 2022';
    Public static testmethod void test() {
        
        Test.startTest();
        Case c = new Case(); // For Case_Number__c is Required
        insert c;
        AccountSetting__c acs = new AccountSetting__c(Unread__c = 10, Read__c = 20);
        insert acs;
        Account acc = new Account (Case_Number__c = c.id,is_Read__c = TRUE);
        insert acc;
         List<Attachment> attachments=[select id, name from Attachment where parent.id=:ems.id];
        //System.assertEquals(1, attachments.size());
        delete attachments;
        String jobId = System.schedule('ScheduleApexClassTest23',CRON_EXP,new DeleteAttachmentScheduleClass22());
        Test.stopTest();       
    }
   
}

User-added image
Hi Please Tell me anyone,

How to Delete Account Related Attachments Using Schedule Apex or How to Take Related Account Attachments to bring SOQL Query ?

Thanks in Advance

I have created list of events in different dates. After the creation of the Events, I need to display those events in the site.com VF Page. But, when I was trying to show the account details, It is working fine. But, when I was trying to display the events. the events are not displaying in the site VF Page.

I need help for you to solve this issue.

Here I will put my code.


Controller Class:
public with sharing class EventController {
    private Datetime eventStartDateTime {get; set;}
    private Datetime eventEndDateTime {get; set;}
    private Datetime agentStartDateTime {get; set;}
    private DateTime agentEndDateTime {get; set;}
    private List<Event> listOfEvents {get; set;}

    public EventController(){ 
    }
    
   public List<Event> getListOfEvents(){
         listOfEvents = [SELECT  OwnerId, CreatedById, ActivityDate, StartDateTime, EndDateTime, Location FROM EVENT];
        return listOfEvents;
    }


VF Page Code:

<apex:page Controller="EventController">
    <apex:form >
   <apex:pageBlock title="Events Block">
       
      <apex:pageBlockTable value="{!listOfEvents}" var="event" id="table">
          <apex:column headerValue="Activity Id" value="{!event.Id}"/>
          <apex:column headerValue="Assigned To" value="{!event.OwnerId}"/>
          <apex:column headerValue="Created By" value="{!event.CreatedById}"/>
          <apex:column headerValue="Activity Date" value="{!event.ActivityDate}"/>
          <apex:column headerValue="StartDateTime" value="{!event.StartDateTime}"/>
          <apex:column headerValue="EndDateTime" value="{!event.EndDateTime}"/>
          <apex:column headerValue="Location" value="{!event.Location}"/>
      </apex:pageBlockTable>
   </apex:pageBlock>
    </apex:form>
</apex:page>

Is this the right order of execution in Salesforce with these options? If not please suggest. Thanks
1. system validation rules
2. Executes all before trigger
3. Custom Validation Rule
4. Execute all after trigger
5.Execute assignment rule
6. Execute Auto response rule
7. Execute workflow rule
8. Execute escalation rules

 
Dear,

At the moment I need to create a custom web form for a company.
They already made another custom web form and registered a force.com site domain name.
Example :  http://ourcompany.force.com/
I did read you can only use one domain name so I was thinking I need to do this:

For their already existing webform, it should change to http://ourcompany.force.com/existingwebform
and for my new webform i need to create this                http://ourcompany.force.com/mynewwebform

is this true? or am I really talking nonsense (sorry I'm really new to the platform 2 months and all is new for me)also if true, is adjusting from http://ourcompany.force.com/ to http://ourcompany.force.com/existingwebform a big deal i.e what do I have to change in that other web form?

thanks for any reply, any help is welcome :)
I have an Apex class I borrowed from the community, but I need help building a test class before I can deploy to production.  Can someone help me?  I plan on going through some tutorials, but I am in a time crunch to get this deployed.

Here is my Apex Class (it is short):

public class preChatRemoting_Con 
{
    public preChatRemoting_Con(ApexPages.StandardController controller) 
    {

    }
    @RemoteAction
    public static contact getcontact(string contactemail)
    {
        Contact testContact=new Contact();
        testContact=[Select Id,Name from Contact where email=:contactemail limit 1];
        return testContact;
    }

}
  • September 28, 2017
  • Like
  • 0
When trying to Compile All Classes, I am getting an Insufficient Privileges error.  This jsut started happening yesterday. 

Where can I start looking to figure out why this is happening?
Hi

Please help to write the TEST class for the following apex class:-
public with sharing class Controller_QuotePage {
   public Opportunity qt {get; set;}
   public List<Opportunity_Product__c> theLineItems {get; set;}
   public Controller_QuotePage(ApexPages.StandardController controller) 
   {
       Id quoteID = ((Opportunity) controller.getRecord()).Id;
       loadQuote(quoteId);
       loadQuoteLineItems(quoteId);
    }
    
    public List<Opportunity_Product__c> getLineItems(){
         
         return theLineItems;
    }
    

   private void loadQuote(String quoteId) {
        this.qt = [Select Id, Name       
                   FROM Opportunity where    
                  Id=:quoteId];  
      
   }
    
   private void loadQuoteLineItems(String quoteId) {

       this.theLineItems = [SELECT Id, Name                          
                             FROM Opportunity_Product__c WHERE Opportunity__c =:   
                             quoteId];  
            
    }


}

 
Hi Everyone,
How to write a trigger to on EmailMessage object to update Contact values.
Can anyone help on this?
Thank you
i need to write apex class to exceute calculate button on daily basis . can someone help with the apex code ,i am new in batch scheduling, i need to click on calculate button on daily basis
User-added image
Hello,
SSN number format in Visualforce page using Jquery or Javascript to Mask all
characters with (XXX-XX-XXXX)

Can anyone help me on this?

Thank you.
Hi Folks,

When i try to share Dashboards to particular user. When i try to customize my home page in user i got this notifation.  "Please have your adminstaror enable at least one dashboard for you to view"

The follwing are screenshot for reference.

User-added image
Hi Folks,

I have a picklist Countries__c in that values
United States US,
United Kingdom UK,
India IN these are the picklist values.
Now My Scenario is I want to select United Kingdom UK it will be populated as UK in another Formula field.

Thanks in advance.

Can you Please Tell me how to make formula for this...?
 
Hi All,

Can anyone share the code snippet of Dependent Picklist using Dynamic Apex

Regards
Hi All,

Can any one help me my search was not working properly

Controller:
public with sharing class ContactSearchController {
    // the soql without the order and limit
  private String soql {get;set;}
  // the collection of contacts to display
  public List<Contact> contacts {get;set;}
  // the current sort direction. defaults to asc
  public String sortDir {
    get  { if (sortDir == null) {  sortDir = 'asc'; } return sortDir;  }
    set;
  }
  // the current field to sort by. defaults to last name
  public String sortField {
    get  { if (sortField == null) {sortField = 'lastName'; } return sortField;  }
    set;
  }
  // format the soql for display on the visualforce page
  public String debugSoql {
    get { return soql + ' order by ' + sortField + ' ' + sortDir + ' limit 20'; }
    set;
  }
  // init the controller and display some sample data when the page loads
  public ContactSearchController() {
    soql = 'SELECT Name,Account.Name,Email,OtherCity,OtherCountry,OtherState,Phone FROM Contact where account.name != null';
    runQuery();
  }
  // toggles the sorting of query from asc<-->desc
  public void toggleSort() {
    // simply toggle the direction
    sortDir = sortDir.equals('asc') ? 'desc' : 'asc';
    // run the query again
    runQuery();
  }
  // runs the actual query
  public void runQuery() {

    try {
      contacts = Database.query(soql + ' order by ' + sortField + ' ' + sortDir + ' limit 20');
    } catch (Exception e) {
      ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Ooops!'));
    }

  }
  // runs the search with parameters passed via Javascript
  public PageReference runSearch() {

    String name = Apexpages.currentPage().getParameters().get('name');
    String AccountName = Apexpages.currentPage().getParameters().get('AccountName');
    String email = Apexpages.currentPage().getParameters().get('email');
    String city = Apexpages.currentPage().getParameters().get('city');
    String state = Apexpages.currentPage().getParameters().get('state');
    String country = Apexpages.currentPage().getParameters().get('country');
    String phone = Apexpages.currentPage().getParameters().get('phone');

    soql = 'SELECT Name,Account.Name,Email,OtherCity,OtherCountry,OtherState,Phone FROM Contact where name != null';
    
    if (!name.equals(''))
    soql += ' and name LIKE \''+String.escapeSingleQuotes(name)+'%\'';
    if (!AccountName.equals(''))
    soql += ' and Account.Name LIKE \''+String.escapeSingleQuotes(AccountName)+'%\'';
    if (!email.equals(''))
    soql += ' and Email LIKE \''+String.escapeSingleQuotes(email)+'%\'';
    if (!city.equals(''))
    soql += ' and OtherCity LIKE \''+String.escapeSingleQuotes(city)+'%\'';
    if (!state.equals(''))
    soql += ' and OtherState LIKE \''+String.escapeSingleQuotes(state)+'%\'';
    if (!country.equals(''))
    soql += ' and OtherCountry LIKE \''+String.escapeSingleQuotes(country)+'%\'';
    if (!phone.equals(''))
    soql += ' and Phone LIKE \''+String.escapeSingleQuotes(phone)+'%\'';

    // run the query again
    runQuery();
    
    return null;
  }
  // runs the search with parameters passed via Javascript
 /* public PageReference runSearch() {

    String Name = Apexpages.currentPage().getParameters().get('Name');
    String AccountName = Apexpages.currentPage().getParameters().get('AccountName');
    String email = Apexpages.currentPage().getParameters().get('email');
    String city = Apexpages.currentPage().getParameters().get('city');
    String state = Apexpages.currentPage().getParameters().get('state');
    String country = Apexpages.currentPage().getParameters().get('country');
    String phone = Apexpages.currentPage().getParameters().get('phone');

    soql = 'SELECT Name,Account.Name,Email,OtherCity,OtherCountry,OtherState,Phone FROM Contact where account.name != null';
    if (!Name.equals(''))
      soql += ' and name LIKE ''+String.escapeSingleQuotes(Name)+'%'';
    
    if (!accountName.equals(''))
      soql += ' and account.name LIKE ''+String.escapeSingleQuotes(accountName)+'%'';
      if (!email.equals(''))
      soql += ' and email LIKE ''+String.escapeSingleQuotes(email)+'%'';
      if (!city.equals(''))
      soql += ' and city LIKE ''+String.escapeSingleQuotes(city)+'%'';  
      if (!state.equals(''))
      soql += ' and state LIKE ''+String.escapeSingleQuotes(state)+'%'';
      if (!country.equals(''))
      soql += ' and country LIKE ''+String.escapeSingleQuotes(country)+'%'';
      if (!phone.equals(''))
      soql += ' and phone LIKE ''+String.escapeSingleQuotes(phone)+'%'';

    // run the query again
    runQuery();

    return null;
  }*/
}

Visualforce Page:
 
<apex:page controller="ContactSearchController" sidebar="false">

  <apex:form >
  <apex:pageMessages id="errors" />

  <apex:pageBlock title="Contact Search" mode="edit">

  <table width="100%" border="0">
  <tr>  
    <td width="200" valign="top">

      <apex:pageBlock title="Parameters" mode="edit" id="criteria">

      <script type="text/javascript">
      function doSearch() {
        searchServer(
          document.getElementById("Name").value,
          document.getElementById("accountName").value,
          document.getElementById("email").value,
          document.getElementById("city").value,
          document.getElementById("State").value,
          document.getElementById("Country").value,
          document.getElementById("phone").value
          );
      }
      </script> 

      <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors">
          <apex:param name="Name" value="" />
          <apex:param name="accountName" value="" />
          <apex:param name="email" value="" />
          <apex:param name="city" value="" />
          <apex:param name="state" value="" />
          <apex:param name="country" value="" />
          <apex:param name="phone" value="" />
      </apex:actionFunction>

      <table cellpadding="2" cellspacing="2">
      <tr>
        <td style="font-weight:bold;">Name<br/>
        <input type="text" id="firstName" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Office Name<br/>
        <input type="text" id="accountName" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Email<br/>
        <input type="text" id="email" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">City<br/>
        <input type="text" id="city" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">State<br/>
        <input type="text" id="state" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Country<br/>
        <input type="text" id="country" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Phone<br/>
        <input type="text" id="phone" onkeyup="doSearch();"/>
        </td>
      </tr>
      </table>

      </apex:pageBlock>

    </td>
    <td valign="top">

    <apex:pageBlock mode="edit" id="results">

        <apex:pageBlockTable value="{!contacts}" var="contact">

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.Name}"/>
            </apex:column>

            <!--<apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Last Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="lastName" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.lastName}"/>
            </apex:column>-->

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Office Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="account.name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.account.name}"/>
            </apex:column>

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Email" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Email" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.Email}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="City" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="City" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.OtherCity}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="State" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="State" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.OtherState}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Country" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="OtherCountry" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.OtherCountry}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Phone" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Phone" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.Phone}"/>
            </apex:column>

        </apex:pageBlockTable>

    </apex:pageBlock>

    </td>
  </tr>
  </table>

  <apex:pageBlock title="Debug - SOQL" id="debug">
      <apex:outputText value="{!debugSoql}" />           
  </apex:pageBlock>    

  </apex:pageBlock>

  </apex:form>

</apex:page>

Thanks in Advance
<apex:page standardController="Registration__c" sidebar="false" showheader="false" tabStyle="Employee__c">
<apex:form >
  <apex:pageBlock >
   <div align="left">
    <!-- <apex:image value="{!$Resource.Emplyee_VF_Logo}" style="margin-left:20px"/> -->
    <apex:image url="{!URLFOR($Resource.Emplyee_VF_imgs, 'images/Employees.jpg')}"/>
   </div>
   <div align="center">
    <apex:outputLabel value="Employee Registration__c" style="font-weight:bold;font-size:25px;color:#B80000"/>   
   </div>
   <hr/><br/><br/>
   <apex:pageBlockSection columns="2" title="Please fill your details" collapsible="false">
    <apex:pageBlockSectionItem >
     <apex:outputLabel value="First Name"/>
     <apex:inputtext value="{!Registration__c.First_Name__c}"/>
    </apex:pageBlockSectionItem>
    <apex:pageBlockSectionItem >
     <apex:outputLabel value="Last Name"/>
     <apex:inputField value="{!Registration__c.name}"/>
    </apex:pageBlockSectionItem>
    <apex:pageBlockSectionItem >
     <apex:outputLabel value="Email"/>
     <apex:inputtext value="{!Registration__c.Email__c}"/>
    </apex:pageBlockSectionItem>
    <apex:pageBlockSectionItem >
     <apex:outputLabel value="Username"/>
     <apex:inputtext value="{!Registration__c.Username__c}"/>
    </apex:pageBlockSectionItem>  
    <apex:pageBlockSectionItem >
     <apex:outputLabel value="Password"/>
     <apex:inputsecret value="{!Registration__c.Password__c}"/>
    </apex:pageBlockSectionItem>
    <apex:pageBlockSectionItem >
     <apex:outputLabel value="Confirm Password"/>
     <apex:inputsecret value="{!Registration__c.Confirm_Password__c}"/>
    </apex:pageBlockSectionItem>
    <apex:pageBlockSectionItem >
     <apex:outputLabel value="Birthdate"/>
     <apex:inputField value="{!Registration__c.Birthdate__c}"/>
    </apex:pageBlockSectionItem>
    <apex:pageBlockSectionItem >
     <apex:outputLabel value="City"/>
     <apex:inputField value="{!Registration__c.City__c}"/>
    </apex:pageBlockSectionItem>
    <apex:pageBlockSectionItem >
     <apex:outputLabel value="Country"/>
     <apex:inputtext value="{!Registration__c.Country__c}"/>
    </apex:pageBlockSectionItem>
   </apex:pageBlockSection>
   <apex:panelGrid columns="3" style="margin-left:60px">
    <apex:commandButton value="Submit" action="{!Save}"/>
    <apex:commandButton value="Cancel" action="{!Cancel}"/>   
   </apex:panelGrid>
  </apex:pageBlock>
</apex:form>
</apex:page>
Best Practice : When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.

User-added image


      That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it. 

Thanks #Copy_Steve Molis
We are a fast growing ISV & marketing company located in Istanbul developing our own big scale managed app to be published on Appexchange. We have a developer team of Turkish and Indian admins & developers and looking for a "senior salesforce developer" to join our team in Istanbul office. 

Do you have ;

2 years of professional Salesforce experience?
Hands on experience with Apex and Visualforce?
Full understanding (written & oral) of English language?
Salesforce certifications? (would be good)
Developed on a managed package project before (would be good)
Web service integrations (would be good)
infrastructure knowledge (would be good)


If so, then your daily tasks will include:


Implementing the required functionality on VF screens, classes and triggers.
Working hand in hand with the Product Management & Improving Salesforce’s functioning.


We offer ;

A loft type office in the heart of Istanbul
An attractive salary structure
Great opportunity to develop your knowledge and experience through new projects on appexchange
Support in accomodation (if needed)
 

Please contact me for more information
ozan@360drcmarketing.com / 00 90 532 3772595
 

Hi,

 

I have two picklist fields.

 

I am able to apply style for controlling field but the style is not getting applied to dependent picklist.

 

Does anyone know how to apply style to dependent picklist.

 

Even I put javascript for onchange event of controlling picklist field to apply style for dependent picklist.

But it is not working.

 

It will be great help if some one have any idea to do it.

 

Thanks!