You need to sign in to do that
Don't have an account?

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
IPHONE
SONY
Samsung :(user Clicks First lookup values is Samsung in second lookup need to display some dependeny mentioned below )
Product Name/code(Lookup)
S-3652
S-2564
S-1234
IPHONE:(user Clicks First lookup values is IPHONE in second lookup need to display some dependeny mentioned below )
Product name/code(Lookup)
I6
I7
I8
Sony:(user Clicks First lookup values is Sony in second lookup need to display some dependeny mentioned below )
Product Name/code(Lookup)
Sony-1234
Sony-5664
Sony-4568
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 .
PFA

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
IPHONE
SONY
Samsung :(user Clicks First lookup values is Samsung in second lookup need to display some dependeny mentioned below )
Product Name/code(Lookup)
S-3652
S-2564
S-1234
IPHONE:(user Clicks First lookup values is IPHONE in second lookup need to display some dependeny mentioned below )
Product name/code(Lookup)
I6
I7
I8
Sony:(user Clicks First lookup values is Sony in second lookup need to display some dependeny mentioned below )
Product Name/code(Lookup)
Sony-1234
Sony-5664
Sony-4568
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 .
PFA
You can use the lookup filter to get appropriate records.
Regards,
Ajay Mishra
Thanks for your reply.
my requirement is dependency between two lookup fields .is it posible to achive lookup filters ?
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
Output
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)
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>
<style>
table#tg1 {
border-collapse: collapse;
background-color:white;
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;
}
</style>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto">
</div>
<br/>
<apex:outputText escape="true" value="{!str_Data}"></apex:outputText>
<!--<script>
$(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}
});
});
-->
<script>
$(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],
}]
});
});
</script>
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){
if(mapSummary.containsKey(p.External_Product__c+'#'+Type+'#'+p.Year__c+'-'+p.Month__c)){
pval += mapSummary.get(p.External_Product__c+'#'+Type+'#'+p.Year__c+'-'+p.Month__c);
}
//system.debug('pval'+pval);
mapSummary.put(p.External_Product__c+'#'+Type+'#'+p.Year__c+'-'+p.Month__c,pval);
//system.debug('Mapsummary'+mapsummary);
}
map<string,decimal> mapSummary;
public AccountReviewController(ApexPages.StandardController controller) {
ID accid = ApexPages.currentPage().getParameters().get('id');
if(accid!=null){
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 ){
setEXPro.add(p.External_Product__c);
}
}
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++){
FYMonth--;
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])
{
psales.add(p);
}
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){
setProduct.add(p.External_Product__r.Product_Name__c);
mapProduct.put(p.Year__c+'#'+p.Month__c,p);
decimal rev = p.No_of_Reviews__c;
if(mapReview.containsKey(p.Year__c+'#'+p.Month__c)){
rev += mapReview.get(p.Year__c+'#'+p.Month__c);
}
mapReview.put(p.Year__c+'#'+p.Month__c,rev);
decimal revavg = p.Avg_Review__c;
if(mapReviewAvg.containsKey(p.Year__c+'#'+p.Month__c)){
revavg += mapReviewAvg.get(p.Year__c+'#'+p.Month__c);
}
mapReviewAvg.put(p.Year__c+'#'+p.Month__c,revavg);
Decimal Count=1;
if(MonthYearToNumberRecordCountMap.containsKey(p.Year__c+'#'+p.Month__c))
Count += MonthYearToNumberRecordCountMap.get(p.Year__c+'#'+p.Month__c);
MonthYearToNumberRecordCountMap.put(p.Year__c+'#'+p.Month__c,Count);
}
system.debug('MonthYearToNumberRecordCountMap'+MonthYearToNumberRecordCountMap);
System.debug('mapReviewAvg==>'+mapReviewAvg);
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));
}
if(lstPeriods.size()>0){
lstPeriods.sort();
}
map<integer,string> monthtomonthstr = new map<integer,string>();
monthtomonthstr.put(1,'Jan');
monthtomonthstr.put(2,'Feb');
monthtomonthstr.put(3,'Mar');
monthtomonthstr.put(4,'Apr');
monthtomonthstr.put(5,'May');
monthtomonthstr.put(6,'June');
monthtomonthstr.put(7,'July');
monthtomonthstr.put(8,'Aug');
monthtomonthstr.put(9,'Sept');
monthtomonthstr.put(10,'Oct');
monthtomonthstr.put(11,'Nov');
monthtomonthstr.put(12,'Dec');
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){
setPeriods.add(p.Name);
}
JSONGenerator genPIE = JSON.createGenerator(true);
genPIE.writeStartArray();
List<decimal> lstTotal = new List<decimal>();
List<decimal> lstTotalAvg = new List<decimal>();
for(Period p: lstPeriodsWrapper){
decimal temp = 0;
if(mapReview.containsKey(p.year+'#'+p.Month)){
temp = mapReview.get(p.year+'#'+p.Month);
system.debug('p.year+#+p.Month'+p.year+'#'+p.Month);
system.debug('mapReview.get(p.year++p.Month)==>'+mapReview.get(p.year+'#'+p.Month));
}
lstTotal.add(temp);
decimal tempavg = 0;
if(mapReviewAvg.containsKey(p.year+'#'+p.Month)){
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 ));
system.debug('p.year+#+p.Month'+p.year+'#'+p.Month);
system.debug('mapReviewAvg.get(p.year+p.Month)==>'+mapReviewAvg.get(p.year+'#'+p.Month));
system.debug('MonthYearToNumberRecordCountMap'+MonthYearToNumberRecordCountMap.get(p.year+'#'+p.Month));
}
lstTotalAvg.add(tempavg);
}
genPIE.writeStartObject();
genPIE.writeStringField('name', 'Review');
genPIE.writeFieldName('data');
genPIE.writeObject(lstTotal);
genPIE.writeEndObject();
genPIE.writeStartObject();
genPIE.writeStringField('name', 'Review Average');
genPIE.writeFieldName('data');
genPIE.writeObject(lstTotalAvg);
genPIE.writeEndObject();
genPIE.writeEndArray();
Str_GraphAmount = genPIE.getAsString();
JSONGenerator gen1 = JSON.createGenerator(true);
gen1.writeObject(setPeriods);
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;
}
}
}
Challenge Not yet complete... here's what's wrong:
Couldn't find an active Sales Path named 'Opportunity Path'.
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"
class="com.salesforce.dataloader.process.ProcessRunner"
singleton="false">
<description>csvAccountExtract job gets account info from salesforce and saves info into a CSV file."</description>
<property name="name" value="csvAccountExtract"/>
<property name="configOverrideMap">
<map>
<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"/>
</map>
</property>
</bean>
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
Regards,
Tulika
public class Caluclator_Example{
public integer aval {set;get;}
public integer bval {set;get;}
public integer result{set;get;}
public void Add(){
result=aval+bval;
}
public void cancel(){
aval=null;
bval=null;
result=null;
}
}
iwrote this quetion in apex class
<apex:page controller="Caluclator_Example" >
<apex:sectionHeader title="Caluclator" subtitle="Example"/>
<apex:form>
<apex:pageBlock title="Caluclator">
<apex:pageBlockButtons location="top">
<apex:commandButton value="Add"/>
<apex:commandButton value="cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection>
<apex:pageBlockSectionItem>
<apex:outputLabel value="aval"/>
<apex:inputText value="{!aval}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel value="bval"/>
<apex:inputText value="{!bval}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel value="Result"/>
<apex:inputText value="{!Result}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
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'
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 ');
}
}
??? can any one help for write trigger for this
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
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!!
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