+ Start a Discussion
Sasidhar Reddy BSasidhar Reddy B 

post question

Hi Everyone,

My Scenario is create two fields
product category” as the first lookup(Product2) and then the “Product Name/Code” as the second lookup(Product2) into Child Object (Request__c).

Note:  here main problem is reffering same Parent Object(Product2) in Child Object

Here my client expecting first lookup user going to select perticuler Category 

Product Category 

Samsung :(user Clicks First lookup values is Samsung in second lookup need to display some dependeny mentioned below )

Product  Name/code(Lookup)

IPHONE:(user Clicks First lookup values is IPHONE in second lookup need to display some dependeny mentioned below )

Product name/code(Lookup)

Sony:(user Clicks First lookup values is Sony in second lookup need to display some dependeny mentioned below )

Product Name/code(Lookup)

I'm implemented same functionlity using picklist dependency its working fine but my client expecting above scenario. 

Can you please guide me how to achive this scenrion in Salesforce .


User-added image
Ajay mishraAjay mishra
Hi Sasidhar,

You can use the lookup filter to get appropriate records.

Ajay Mishra
Sasidhar Reddy BSasidhar Reddy B
Hi Ajay,

Thanks for your reply.
my requirement is dependency between two lookup fields .is it posible to achive lookup filters ? 

Jyothi Hale 29Jyothi Hale 29
​My Requirement of Combinational High Charts (Dual charts)
 I have a table called Reviews from where i need to retrieve all the records and sum up the values of Avg Review and no of revies by monthly 

ex review table data :
productname       avg reviews      no.of reviews      year         month
           abc                  4                           3                2017       Jan
           xyz                 4                           3                     2017       Jan
           test                  4                           3                     2017       feb
            test3                4                           3                     2017       feb

 x- axis  jan 2017   feb 2017 ( which display data from current month to previous 12months)
Y-axis : Left side ( Avg Reviews )  4+4/no.of records =8/2 = 4 for Jan 2017 (Line chart )
Y-axis  : Right side(No.of Reviews) 3+3 = 6 for Jan 2017   (column or bar chart representation)

User-added image

Visual force Page
<apex:page standardController="Account" extensions="AccountReviewController">
    <script src="https://code.jquery.com/jquery-1.9.1.js"></script>
    <script src="https://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <script src="https://code.highcharts.com/highcharts.js"></script>
   <script src="https://code.highcharts.com/modules/exporting.js"></script>
  table#tg1 {
      border-collapse: collapse;
      width: 100%;
  table#tg1,table#tg1 th,table#tg1 td {
    border: 1px solid #DBDBDB;
    border-collapse: collapse;

  table#tg1 th,table#tg1 td {
      text-align: left;
      padding: 8px;
  table#tg1 th {
      background-color: #304F1D;
      color: white;
    <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto">        
    <apex:outputText escape="true" value="{!str_Data}"></apex:outputText>
        $(function () {
            Highcharts.chart('container', {
                title: {
                    text: 'Account Reviews '

                subtitle: {
                    text: 'Reviews by Months'
                xAxis: {
                         categories: {!Str_Periods}
                yAxis: {
                    title: {
                        text: 'No.of Reviews'
                legend: {
                    layout: 'vertical',
                    align: 'right',
                    verticalAlign: 'middle'
                series: {!Str_GraphAmount}

      $(function () {  
   Highcharts.chart('container', {
    chart: {
        zoomType: 'xy'
    title: {
        text: 'Account Reviews'
    subtitle: {
        text: 'Reviews by Months'
    xAxis: [{
        categories: {!Str_Periods},
        crosshair: false
    yAxis: [{ // Primary yAxis
        labels: {
            format: '',
            style: {
                color: Highcharts.getOptions().colors[1]
        title: {
            text: 'Avg Reviews',
            style: {
                color: Highcharts.getOptions().colors[1]
    }, { // Secondary yAxis
        title: {
            text: 'No.of Reviews',
            style: {
                color: Highcharts.getOptions().colors[0]
        labels: {
            format: '{value}',
            style: {
                color: Highcharts.getOptions().colors[0]
        opposite: true
    tooltip: {
        shared: true
    legend: {
        layout: 'vertical',
        align: 'left',
        x: 120,
        verticalAlign: 'top',
        y: 100,
        floating: true,
        backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || 'gray'
    series: [{
        name: 'No.Of Reviews',
        type: 'column',
        yAxis: 1,
        data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
    }, {
        name: 'Avg Reviews',
        type: 'spline',
        data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],

Apex Controller

public with sharing class AccountReviewController {

    public string Str_Periods{get;set;}
    public string Str_GraphAmount{get;set;}    
    public string str_Data{get;set;}
    public void setSummaryTable(Reviews__c p,decimal pval, String Type){
            pval += mapSummary.get(p.External_Product__c+'#'+Type+'#'+p.Year__c+'-'+p.Month__c);            

    map<string,decimal> mapSummary;
    public AccountReviewController(ApexPages.StandardController controller) {
        ID accid = ApexPages.currentPage().getParameters().get('id');
            set<Id> setEXPro = new set<Id>();
            for(ProductAccount__c p: [SELECT Id, Account__c, External_Product__c FROM ProductAccount__c WHERE Account__c=:accid]){
                if(p.External_Product__c <> null ){
            if(setEXPro.size() > 0)
                set<string> setFYKey= new set<string>();                
                Integer FYYear = system.today().Year();
                Integer FYMonth = system.today().Month();
                if(FYMonth < 10)setFYKey.add(FYYear+'-0'+FYMonth);
                else setFYKey.add(FYYear+'-'+FYMonth);
                for(Integer i = 0;i<12;i++){
                    if(FYMonth == 0){FYMonth = 12;FYYear--;}
                    if(FYMonth < 10)setFYKey.add(FYYear+'-0'+FYMonth);
                    else setFYKey.add(FYYear+'-'+FYMonth);
                List<Reviews__c> psales=new List<Reviews__c>();
                for(Reviews__c p : [SELECT No_of_Reviews__c,Avg_Review__c,External_Product__c, External_Product__r.Product_Name__c, Id, Month__c, monthname__c, Year__c 
                                            FROM Reviews__c 
                                            where External_Product__c IN: setEXPro and YearMonthKey__c IN: setFYKey
                                            ORDER BY External_Product__r.Product_Name__c])

                map<string,decimal> mapReview = new map<string,decimal>();
                map<string,decimal> mapReviewAvg = new map<string,decimal>();
                map<string,Reviews__c> mapProduct = new map<string,Reviews__c>();
                set<string> setProduct = new set<string>(); 
                Map<String, Decimal> MonthYearToNumberRecordCountMap=new Map<String,decimal>();
                for(Reviews__c p : psales){     
                    decimal rev = p.No_of_Reviews__c;
                        rev += mapReview.get(p.Year__c+'#'+p.Month__c);
                    decimal revavg = p.Avg_Review__c;
                        revavg += mapReviewAvg.get(p.Year__c+'#'+p.Month__c);
                    Decimal Count=1;
                        Count += MonthYearToNumberRecordCountMap.get(p.Year__c+'#'+p.Month__c);
                List<Period> lstPeriods= new List<Period>();
                for(string s: mapProduct.keyset()){
                    Reviews__c p = mapProduct.get(s);
                    lstPeriods.add(new period(string.valueOf(p.Year__c+'-'+p.Month__c),p.Year__c,p.monthname__c,p.Month__c));
                map<integer,string> monthtomonthstr = new map<integer,string>();
                List<Period> lstPeriodsWrapper= new List<Period>();
                for(Period s: lstPeriods){
                    //Product_Redemption__c p = mapProduct.get(s);
                   Integer name = Integer.valueOf(s.Name.right(1));
                   String str = s.Name.left(s.Name.length()-1)+monthtomonthstr.get(name);
                    lstPeriodsWrapper.add(new period(str,s.Year,s.MonthName,s.Month));
                set<string> setPeriods = new set<string>();
                for(Period p: lstPeriodsWrapper){
                JSONGenerator genPIE = JSON.createGenerator(true);
                List<decimal> lstTotal = new List<decimal>();
                List<decimal> lstTotalAvg = new List<decimal>();
                for(Period p: lstPeriodsWrapper){
                    decimal temp = 0;
                        temp = mapReview.get(p.year+'#'+p.Month);
                    decimal tempavg = 0;
                        tempavg = ((mapReviewAvg.get(p.year+'#'+p.Month))/((MonthYearToNumberRecordCountMap.get(p.year+'#'+p.Month)!=Null && MonthYearToNumberRecordCountMap.get(p.year+'#'+p.Month)!=0)?MonthYearToNumberRecordCountMap.get(p.year+'#'+p.Month):1 ));
                    genPIE.writeStringField('name', 'Review'); 
                    genPIE.writeStringField('name', 'Review Average'); 

                Str_GraphAmount = genPIE.getAsString();
                JSONGenerator gen1 = JSON.createGenerator(true); 
                Str_Periods = gen1.getAsString();
    public class Period implements Comparable{
        public String Name;
        public decimal Year;
        public String MonthName;
        public decimal Month;
        public Period(String Name,decimal Year,String MonthName,decimal Month){
            this.Name = Name;
            this.Year = Year;
            this.Month = Month;
            this.MonthName = MonthName;
        public Integer compareTo(Object compareTo) {
            Period compareToPlan = (Period)compareTo;
            if (Name == compareToPlan.Name) return 0;
            if (Name > compareToPlan.Name) return 1;
            return -1;        

Madhukar Reddy 23Madhukar Reddy 23
Lightning Experience Rollout Specialist #4
Challenge Not yet complete... here's what's wrong: 
Couldn't find an active Sales Path named 'Opportunity Path'.Help to resolve the solution
Tulika Saha 9Tulika Saha 9

I have tried Dataloader CLI.
I have checked encrypted password and password are same with the command :
"encrypt.bat -v 
generatedPassword actualPassword secretKeyFilePath " and the result is  : "INFO  [main] security.EncryptionUtil main (EncryptionUtil.java:332) - Decryption of encrypted value MATCHES the expected value"

My process-conf.xml is:
<bean id="csvAccountExtractProcess"
      <description>csvAccountExtract job gets account info from salesforce and saves info into a CSV file."</description>
        <property name="name" value="csvAccountExtract"/>
        <property name="configOverrideMap">
                <entry key="sfdc.debugMessages" value="false"/>
                <entry key="sfdc.debugMessagesFile" value="c:\dataloader\samples\status\sfdcSoapTrace.log"/>
                <entry key="sfdc.endpoint" value="https://login.salesforce.com"/>
                <entry key="sfdc.username" value="tulika.sfdc@gmail.com"/>
                <!-- password specified below is invalid, please generate one using the encrypt.bat utility -->
                <entry key="sfdc.password" value="cfc7a77277fa121b1c6cf66efb266d5f"/>
                <entry key="process.encryptionKeyFile" value="C:\Program Files (x86)\salesforce.com\Data Loader\samples\conf\sample.key.txt"/>
                <entry key="sfdc.timeoutSecs" value="600"/>
                <entry key="sfdc.loadBatchSize" value="200"/>
                <entry key="sfdc.entity" value="Account"/>
                <entry key="sfdc.extractionRequestSize" value="500"/>
                <entry key="sfdc.extractionSOQL" value="Select Id, Name, Type, ParentId, Phone, AccountNumber FROM Account"/>
                <entry key="process.operation" value="extract"/>
                <entry key="process.mappingFile" value="c:\dataloader\samples\conf\accountExtractMap.sdl"/>
                <entry key="dataAccess.type" value="csvWrite"/>
                <entry key="dataAccess.name" value="c:\dataloader\samples\data\extract.csv"/>

when I try to execute  the command Process.bat "C:\Program Files (x86)\salesforce.com\Data Loader\samples\conf" Account , 
I get the error:

2017-11-21 19:32:40,484 INFO  [main] controller.Controller initLog (Controller.java:396) - Using built-in logging configuration, no log-conf.xml in C:\Program Files (x86)\salesforce.com\Data Loader\bin\log-conf.xml
2017-11-21 19:32:40,488 INFO  [main] controller.Controller initLog (Controller.java:398) - The log has been initialized
2017-11-21 19:32:40,490 INFO  [main] process.ProcessConfig getBeanFactory (ProcessConfig.java:104) - Loading process configuration from config file: C:\Program Files (x86)\salesforce.com\Data Loader\samples\conf\process-conf.xml
2017-11-21 19:32:40,541 INFO  [main] support.AbstractApplicationContext prepareRefresh (AbstractApplicationContext.java:495) - Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@1e25b76: startup date [Tue Nov 21 19:32:40 IST 2017]; root of context hierarchy
2017-11-21 19:32:40,573 INFO  [main] xml.XmlBeanDefinitionReader loadBeanDefinitions (XmlBeanDefinitionReader.java:315) - Loading XML bean definitions from file [C:\Program Files (x86)\salesforce.com\Data Loader\samples\conf\process-conf.xml]
2017-11-21 19:32:40,613 INFO  [main] support.DefaultListableBeanFactory preInstantiateSingletons (DefaultListableBeanFactory.java:557) - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1a03464: defining beans [accountMasterProcess,opportunityUpsertProcess,databaseAccountExtractProcess,csvAccountExtractProcess,Account]; root of factory hierarchy
2017-11-21 19:32:40,643 INFO  [csvAccountExtract] controller.Controller initConfig (Controller.java:334) - config dir created at C:\Program Files (x86)\salesforce.com\Data Loader\samples\conf
2017-11-21 19:32:40,644 FATAL [csvAccountExtract] process.ProcessRunner topLevelError (ProcessRunner.java:238) - Unable to run process csvAccountExtract
java.lang.RuntimeException: com.salesforce.dataloader.exception.ControllerInitializationException: java.io.IOException: Access is denied
        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:112)
        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
Caused by: com.salesforce.dataloader.exception.ControllerInitializationException: java.io.IOException: Access is denied
        at com.salesforce.dataloader.controller.Controller.initConfig(Controller.java:347)
        at com.salesforce.dataloader.controller.Controller.<init>(Controller.java:110)
        at com.salesforce.dataloader.controller.Controller.getInstance(Controller.java:219)
        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:110)
        ... 2 more
Caused by: java.io.IOException: Access is denied
        at java.io.WinNTFileSystem.createFileExclusively(Native Method)
        at java.io.File.createNewFile(Unknown Source)
        at com.salesforce.dataloader.controller.Controller.initConfig(Controller.java:342)
        ... 5 more

plz tell me how it will be solved

Soene IbaniboSoene Ibanibo
Pls i'm new to SOQL and Visualforce can someone help me correct my code cos  i have been able to display  a record on pdf format but it doesnt match the Record Id and Account the pdf needs to generate from. see code below:
public class contractorController { 
public Contractor_LPO__c purchaseList {get;set;}
 public string recordId {get;set;}
 public contractorController () { recordId = Apexpages.currentPage().getParameters().get('Id'); purchaseList =new Contractor_LPO__c(); purchaseList = [select Id, Contractor_Quote__r.Contractor_Account__c, Contractor_Quote__r.id , Contractor_Quote__r.Amount_in_Words__c, Contractor_LPO__c.Name, Amount_in_Words__c, Contractor_Quote_Approved_Amount__c, Contractor_Quote_Status__c, Contractor_RFQ_Number__c, LPO_Date__c, Payment_Terms_and_Condition__c, Quantity__c, Quote_Description__c , Contractor_Quote__c,Status__c, Tax_Inclusive_Amount__c,Value_Added_Tax__c , VAT_Inclusive__c, Contractor_Account__c from Contractor_LPO__c limit 1]; \
Ple help me as it seems urgent.
Mohit Garg 55Mohit Garg 55
Can someone please guide me how to write the custom setting generic code in apex trigger.?

shabbir ali khanshabbir ali khan
write an example code to bulk(400000)update contacts(status field) records whenever status field on the account has changed and send a email to admin for failure records. this is a daily activity. please follow the best practice. in salesforce
Surender reddy SalukutiSurender reddy Salukuti
public class Caluclator_Example{
    public integer aval {set;get;}
    public integer bval {set;get;}
    public integer result{set;get;}
    public void Add(){
    public void cancel(){
iwrote this quetion in apex class 

<apex:page controller="Caluclator_Example" >
    <apex:sectionHeader title="Caluclator" subtitle="Example"/>
    <apex:pageBlock title="Caluclator">
        <apex:pageBlockButtons location="top">
        <apex:commandButton value="Add"/>
            <apex:commandButton value="cancel"/>
            <apex:outputLabel value="aval"/>
            <apex:inputText value="{!aval}"/>
            <apex:outputLabel value="bval"/>
                     <apex:inputText value="{!bval}"/>
            <apex:outputLabel value="Result"/>
            <apex:inputText value="{!Result}"/>
iwrte this program in visualforce page by using controller i refered apex class

When i running this program getting error message

error-Unknown property 'Caluclator_Example.aval'
Requirements 8Requirements 8
How to avoid case sensitive  issue while comaparing between two object field values with the same field value 
Hello Salesforce Experts,

 I am new to developer forum and need your guidance. There is a Single select Picklist field (Primary) and Multi-Select Picklist field (Secondary) and these fields are added to Opportunity Object. The data validation to happen before insert, before update of the opportunity record. 
Requirement : User should not be allowed to select the value in Secondary (mult-select picklist) same as Primary.

Validation rule/ process builder doesn't work for this due to limitations on multi-select picklist and validation needs to be done before insert / update.
I started writing Trigger for this. However, below code snippet is not working. Appreciate any help.

if(Trigger.IsInsert || Trigger.IsUpdate)
            If (O.Secondary__c,CONTAINS(O.Primary__c)) {
                O.addError('Secondary cannot have same value as Primary ');

Steve Lee 19Steve Lee 19
How to get records from standard list view in lightning component.............. please help if you can
If i have one account obeject and  5 or n number of contacts tlinked with that account ..if all contacts is closed than we need to display account status as 'completed' using triggers.
??? can any one help for write trigger for this
Bvenkat Jeewesh(Dev)Bvenkat Jeewesh(Dev)
Hi All, 
I am working on Marketing Cloud in my Dev Org have followed all of the steps in Trailhead module.
 but when i click log into marketing cloud, password does not exits found.
Please Help me out.
With Regards,
Bvenkat Jeewesh
Nidhi Verma 8Nidhi Verma 8
Hi All,
I am new in salesforce development. There is one scenario to update one field on Account object at time of new account creation.There is one other custom object called sports__c which is having two another field i.e. sportsname__c and sportsnumber, and these two fiels also exist on Account object. On creation of new account this sportsname should populate based on the sportsnumber.
Please help in this regards!!
Chetana MalakannavarChetana Malakannavar
Hi All,
I am working on Lightning Readiness report ,There is one scenario, i have to get the count of sharing button present in page layout of objects in the Org, using soql. can anyone help with the soql 
Raghuram GowlikarRaghuram Gowlikar
after clicking on save button it should show a popup saying error if fields are empty else show success popup and redirect to a page? please help me