-
ChatterFeed
-
4Best Answers
-
2Likes Received
-
3Likes Given
-
55Questions
-
66Replies
Dependent Picklist value in Apex
Hi folks,
Can anyone tell me how to get the dependent picklist values based on the Controlling picklist value in Apex?
I need a sample code for that..
Thanks in advance
Karthick
Can anyone tell me how to get the dependent picklist values based on the Controlling picklist value in Apex?
I need a sample code for that..
Thanks in advance
Karthick
-
- SS Karthick
- November 19, 2014
- Like
- 0
- Continue reading or reply
What are case-insensitive in Apex ?
Hi guys.
I started to learn Apex recently.
Then I found that many things can be write with case insensitive character.
Such as:
Just to make sure, are there other case-insensitive things that can be happen on Apex ?
I started to learn Apex recently.
Then I found that many things can be write with case insensitive character.
Such as:
- Object name:
- You can write
public pagereference method1() { ..}
instead of -
public PageReference method1() { ..}
- You can write
- Variable name
- This will be compile error
-
Integer I; Integer i;
- SOQL and SOSL statements
-
Account[] accts = [sELect ID From ACCouNT where nAme = 'fred'];
-
Just to make sure, are there other case-insensitive things that can be happen on Apex ?
-
- Arufian
- November 07, 2014
- Like
- 0
- Continue reading or reply
Visualforce Error Help for this Page System.NullPointerException: Argument 1 cannot be null
<apex:page standardcontroller="MPI_Category__c" extensions="MPIController1" action="{!autoRun}"
tabStyle="Contact">
<style type="text/css">
.m1{
width: 60px;
}
</style>
<apex:form >
<apex:actionFunction name="rerenderSg1" rerender="sg1sSelectList1" >
<apex:param name="firstParam" assignTo="{!catalog}" value="" />
</apex:actionFunction>
<apex:sectionHeader title="MPI {!mpi.name}" subtitle="MPI Item Selection" />
<apex:pageBlock >
<table><tbody>
<tr>
<th>Catalog</th>
<td>
<apex:selectList id="catalog" styleclass="std" size="1"
value="{!catalog}" onchange="rerenderSg1(this.value)" >
<apex:selectOptions value="{!catalogsSelectList}"/>
</apex:selectList>
</td>
<th>Segment1</th>
<td>
<apex:selectList id="sg1sSelectList1" styleclass="std" size="1"
value="{!sg1}" >
<apex:selectOptions value="{!sg1sSelectList1}"/>
</apex:selectList>
</td>
</tr>
</tbody>
</table>
</apex:pageblock>
</apex:form>
</apex:page>
public with sharing class MPIController1 {
public MPI_Category__c mpi {get;set;}
public MPI_Category__c mpiObject {get;set;}
public MPIProducts__c mpi1 {get;set;}
public Boolean sg4Bool {get;set;}
public Boolean sg3Bool {get;set;}
public Boolean sg2Bool {get;set;}
public Boolean sg1Bool {get;set;}
ApexPages.StandardController controller;
Public Boolean ShowpageBlockFlag{get;set;}
public MPIController1(ApexPages.StandardController controller) {
this.controller=controller;
mpi=[Select m.Name from MPI_Category__c m where m.id= :ApexPages.currentPage().getParameters().get('id')];
mpiObject = new MPI_Category__c ();
mpiObject = (MPI_Category__c )controller.getRecord();
}
public PageReference autoRun() {
return null;
}
// Variables to store country and state selected by user
public String catalog {get; set;}
public String sg1 {get;set;}
public String sg2 {get;set;}
public String sg3 {get;set;}
public String sg4 {get;set;}
// Generates catalog dropdown from country settings
public List<SelectOption> getCatalogsSelectList()
{
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('', '--SelectOne--'));
// Find all the catalogs in the custom setting
List<product2> prd= [select id, name, MPI_Catalog__c,MPI_Sg1__c,MPI_Sg2__c,MPI_Sg3__c,MPI_Sg4__c from product2 where MPI_Catalog__c!=null];
set<String> s= new Set<String>();
for(Product2 pr:prd)
{
s.add(pr.MPI_Catalog__c);
}
List<String> list1= new List<String>();
list1.addAll(s);
list1.sort();
for(String s1:list1)
{
options.add(new SelectOption(s1, s1));
}
return options;
}
public List<SelectOption> getSg1sSelectList1() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('', '--SelectOne--'));
System.debug('catalog is -----'+catalog);
List<product2> allsg1 =[select MPI_Catalog__c,MPI_Sg1__c from product2 where MPI_Catalog__c=:catalog];
Map<String,String> allSgValues= new Map<String,String>();
for(Product2 p:allsg1)
{
if(p.MPI_Catalog__c==this.catalog)
{
allSgValues.put(p.MPI_Catalog__c,p.MPI_Sg1__c);
options.add(new SelectOption(p.MPI_Catalog__c, p.MPI_Sg1__c));
}
System.debug('allSgValues are-----'+allSgValues);
}
// If no states are found, just say not required in the dropdown.
if (options.size() > 0) {
options.add(0, new SelectOption('', '--Select One--'));
} else {
options.add(new SelectOption('', 'Not Required'));
}
return options;
}
}
this is my page and controller, getSg1sSelectList1() is not renedering properly.so that Argument 1 canot be null cmg. help me on this
tabStyle="Contact">
<style type="text/css">
.m1{
width: 60px;
}
</style>
<apex:form >
<apex:actionFunction name="rerenderSg1" rerender="sg1sSelectList1" >
<apex:param name="firstParam" assignTo="{!catalog}" value="" />
</apex:actionFunction>
<apex:sectionHeader title="MPI {!mpi.name}" subtitle="MPI Item Selection" />
<apex:pageBlock >
<table><tbody>
<tr>
<th>Catalog</th>
<td>
<apex:selectList id="catalog" styleclass="std" size="1"
value="{!catalog}" onchange="rerenderSg1(this.value)" >
<apex:selectOptions value="{!catalogsSelectList}"/>
</apex:selectList>
</td>
<th>Segment1</th>
<td>
<apex:selectList id="sg1sSelectList1" styleclass="std" size="1"
value="{!sg1}" >
<apex:selectOptions value="{!sg1sSelectList1}"/>
</apex:selectList>
</td>
</tr>
</tbody>
</table>
</apex:pageblock>
</apex:form>
</apex:page>
public with sharing class MPIController1 {
public MPI_Category__c mpi {get;set;}
public MPI_Category__c mpiObject {get;set;}
public MPIProducts__c mpi1 {get;set;}
public Boolean sg4Bool {get;set;}
public Boolean sg3Bool {get;set;}
public Boolean sg2Bool {get;set;}
public Boolean sg1Bool {get;set;}
ApexPages.StandardController controller;
Public Boolean ShowpageBlockFlag{get;set;}
public MPIController1(ApexPages.StandardController controller) {
this.controller=controller;
mpi=[Select m.Name from MPI_Category__c m where m.id= :ApexPages.currentPage().getParameters().get('id')];
mpiObject = new MPI_Category__c ();
mpiObject = (MPI_Category__c )controller.getRecord();
}
public PageReference autoRun() {
return null;
}
// Variables to store country and state selected by user
public String catalog {get; set;}
public String sg1 {get;set;}
public String sg2 {get;set;}
public String sg3 {get;set;}
public String sg4 {get;set;}
// Generates catalog dropdown from country settings
public List<SelectOption> getCatalogsSelectList()
{
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('', '--SelectOne--'));
// Find all the catalogs in the custom setting
List<product2> prd= [select id, name, MPI_Catalog__c,MPI_Sg1__c,MPI_Sg2__c,MPI_Sg3__c,MPI_Sg4__c from product2 where MPI_Catalog__c!=null];
set<String> s= new Set<String>();
for(Product2 pr:prd)
{
s.add(pr.MPI_Catalog__c);
}
List<String> list1= new List<String>();
list1.addAll(s);
list1.sort();
for(String s1:list1)
{
options.add(new SelectOption(s1, s1));
}
return options;
}
public List<SelectOption> getSg1sSelectList1() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('', '--SelectOne--'));
System.debug('catalog is -----'+catalog);
List<product2> allsg1 =[select MPI_Catalog__c,MPI_Sg1__c from product2 where MPI_Catalog__c=:catalog];
Map<String,String> allSgValues= new Map<String,String>();
for(Product2 p:allsg1)
{
if(p.MPI_Catalog__c==this.catalog)
{
allSgValues.put(p.MPI_Catalog__c,p.MPI_Sg1__c);
options.add(new SelectOption(p.MPI_Catalog__c, p.MPI_Sg1__c));
}
System.debug('allSgValues are-----'+allSgValues);
}
// If no states are found, just say not required in the dropdown.
if (options.size() > 0) {
options.add(0, new SelectOption('', '--Select One--'));
} else {
options.add(new SelectOption('', 'Not Required'));
}
return options;
}
}
this is my page and controller, getSg1sSelectList1() is not renedering properly.so that Argument 1 canot be null cmg. help me on this
-
- ra811.3921220580267847E12
- July 25, 2014
- Like
- 0
- Continue reading or reply
How to access the Campaign field from lead object to visualforce
Hi All,
I want to access campaign field from lead object to visualforce using custom controller. For this,is the right way to write trigger? Suppose If I write trigger then how to call trigger from visualforce?
Kindly support and suggest.
Thank You.
I want to access campaign field from lead object to visualforce using custom controller. For this,is the right way to write trigger? Suppose If I write trigger then how to call trigger from visualforce?
Kindly support and suggest.
Thank You.
-
- Keerthigee
- July 15, 2014
- Like
- 0
- Continue reading or reply
Outbound message Listener for salesforce
Hi Everyone
Iam working on Workflow Outbound messages which works between two salesforce orgs.
Created workflow outbound messages action for org1.
I got struck with creation of Listener for salesforce org2.
How to create a Outbound message listener...?
Iam working on Workflow Outbound messages which works between two salesforce orgs.
Created workflow outbound messages action for org1.
I got struck with creation of Listener for salesforce org2.
How to create a Outbound message listener...?
-
- Vempally
- May 07, 2016
- Like
- 0
- Continue reading or reply
Error: Compile Error: Field is not writeable: Quote.AccountId at line 20 column 9
Hi Everyone,
Following is the code which is giving the said error in test class...
Following is the code which is giving the said error in test class...
@isTest Public Class QuoteDescription_Test{ Static testMethod void test1(){ Account acc1 = new Account(name = 'Account1'); insert acc1; Opportunity opp1 = new Opportunity (); opp1.Name = 'Opportunity1'; opp1.StageName = 'Prospecting'; opp1.CloseDate = Date.newInstance(2016, 2, 6); insert opp1; Account acc = [Select id, name from Account]; Opportunity opp = [Select id, name from Opportunity]; Quote quo1 = new Quote(); quo1.Name = 'Quote1'; quo1.Accountid = acc.id; quo1.Opportunityid = opp.id; insert quo1; quo1.Status = 'Accepted'; update quo1; } }
-
- Vempally
- April 23, 2016
- Like
- 0
- Continue reading or reply
How to give values to readonly fields in test class..
Hi Everyone,
Iam writing a test class where I need to create a quote and insert it.
Now we have two read-only fields Opportunity and Account.
How can we assign values to these two fields?
Error: Compile Error: Field is not writeable: Account at line 18 column 8
Iam writing a test class where I need to create a quote and insert it.
Now we have two read-only fields Opportunity and Account.
How can we assign values to these two fields?
@isTest Public Class QuoteDescription_Test{ Static testMethod void test1(){ Account acc1 = new Account(name = 'Account1'); insert acc1; Opportunity opp1 = new Opportunity (); opp1.Name = 'Opportunity1'; opp1.StageName = 'Prospecting'; opp1.CloseDate = Date.newInstance(2016, 2, 6); insert opp1; Quote quo1 = new Quote(); quo1.Name = 'quote1'; Account acc = [Select id, name from Account]; quo1.Account = acc; quo1.Opportunity = 'Opportunity1'; quo1.Status = 'Accepted'; insert quo1; }This gives an error
Error: Compile Error: Field is not writeable: Account at line 18 column 8
-
- Vempally
- April 22, 2016
- Like
- 0
- Continue reading or reply
Importing data from attachments
Hi Everyone,
We have an attachment to Account which is an excel file.(Not a CSV)
This excel file contains different sheets which contain contacts.(Different sheets different criteria).
Now on a custom button click i want a particular sheet's contacts to be inserted.
If its a single csv then iam aware of it but an excel file with different sheets.
regards
suresh.
We have an attachment to Account which is an excel file.(Not a CSV)
This excel file contains different sheets which contain contacts.(Different sheets different criteria).
Now on a custom button click i want a particular sheet's contacts to be inserted.
If its a single csv then iam aware of it but an excel file with different sheets.
regards
suresh.
-
- Vempally
- April 18, 2016
- Like
- 0
- Continue reading or reply
How to achieve the following scenario...
Hi Everyone...
I came across a scenario which is as follows...
We have an excel file containing number of contacts as an attachment to Account...
Now, on a button click all the contacts available in th excel file wrt Account should get Inserted...
regards
Suresh.
I came across a scenario which is as follows...
We have an excel file containing number of contacts as an attachment to Account...
Now, on a button click all the contacts available in th excel file wrt Account should get Inserted...
regards
Suresh.
-
- Vempally
- April 02, 2016
- Like
- 0
- Continue reading or reply
Need Trigger for following Scenario...
Hi Everyone...
In Account sObject we have a field named "Phone"...
While Inserting Account a Contact should get created with the value given in field "Phone"...
When Updating the Account if I change the Phone Number then a new contact with new phone number should get created...else nothing should happen...
regards,
Suresh
In Account sObject we have a field named "Phone"...
While Inserting Account a Contact should get created with the value given in field "Phone"...
When Updating the Account if I change the Phone Number then a new contact with new phone number should get created...else nothing should happen...
regards,
Suresh
-
- Vempally
- March 28, 2016
- Like
- 0
- Continue reading or reply
need help with the following trigger
Hi everyone...
In the for loop where iam retrieving contacts based on an account, when SOQL is used its working fine but when the soql is replaced with a a.contacts the for loop is not getting executed... Why...?
trigger CustomRollupSummary on Contact (after insert, after update, after delete, after undelete) { if(trigger.isInsert && Trigger.isAfter){ List<Account> lst_accounts = new list<Account>(); //decimal Value =0; set<id> account_ids = new set<id>(); for(Contact c : trigger.new){ account_ids.add(c.accountid); system.debug('account_ids' + account_ids); } Map<id, Account> map_accounts = new Map<id, Account>([select id, name from Account where id in : account_ids]); system.debug('map_accounts' + map_accounts); system.debug('map_accounts' + map_accounts.values()); for(Account a : map_accounts.values()){ system.debug('account' + a); a.Amount_Sum__c = 0; //for(Contact c :[select id, name, amount__c from contact where accountid =: a.Id]) for(Contact c : a.contacts) { system.debug('Contact' + c); a.Amount_Sum__c += c.amount__c; } lst_accounts.add(a); } system.debug('updated accounts' + lst_accounts); update lst_accounts; } /* List<Contact> lst_contacts = new List<Contact>(); for(Account a : lst_account){ lst_contacts.add(a.contacts); system.debug('lst_contacts'); */ }
In the for loop where iam retrieving contacts based on an account, when SOQL is used its working fine but when the soql is replaced with a a.contacts the for loop is not getting executed... Why...?
-
- Vempally
- March 27, 2016
- Like
- 0
- Continue reading or reply
Overriding a Page for Some, but not All, Users
Hi Everyone,
I've found the code for this at the following link,
http://developer.force.com/cookbook/recipe/overriding-a-page-for-some-but-not-all-users
but not able to understand the following "IF statement"
can anyone explain me what is happening in IF statement...
Iam a NEWBIE...
regards,
Suresh.
I've found the code for this at the following link,
http://developer.force.com/cookbook/recipe/overriding-a-page-for-some-but-not-all-users
but not able to understand the following "IF statement"
<apex:page action= "{!if($Profile.Name !='System Administrator', null, urlFor($Action.Account.Tab, $ObjectType.Account, null, true))}" standardController="Account" recordSetVar="accounts" tabStyle="Account"> <!-- Replace with your markup --> This page replaces your Account home page for all users except Administrators. </apex:page>
can anyone explain me what is happening in IF statement...
Iam a NEWBIE...
regards,
Suresh.
-
- Vempally
- March 04, 2016
- Like
- 1
- Continue reading or reply
Required Trigger on child accessing parent field and updating parent.
Hi Everyone,
Can anyone give the code and explanation where i need to udate parent field with the value calculated with child fields.
Eg: Rollup Summary for Sum(). Need trigger code fro this for understanding.
Can anyone give the code and explanation where i need to udate parent field with the value calculated with child fields.
Eg: Rollup Summary for Sum(). Need trigger code fro this for understanding.
-
- Vempally
- February 29, 2016
- Like
- 0
- Continue reading or reply
Bypass validations for a particular user...
Hi Everyone,
If we have 10 users with permission to use Data Loader... I want to bypass validatios for a particular user...
How to achieve this...?
If we have 10 users with permission to use Data Loader... I want to bypass validatios for a particular user...
How to achieve this...?
-
- Vempally
- February 22, 2016
- Like
- 0
- Continue reading or reply
Use of the term <sObject> in batch apex...
Hi Everyone,
In Batch Apex can anyone explain me what this <sObject> is needed for. what exactly it does...?
In Batch Apex can anyone explain me what this <sObject> is needed for. what exactly it does...?
-
- Vempally
- February 21, 2016
- Like
- 0
- Continue reading or reply
Wrapper List in Batch Apex...
Hi everyone,
I came across an interview quetion where I was asked to use a WrapList in Batch Apex.
How to do it...?
I came across an interview quetion where I was asked to use a WrapList in Batch Apex.
How to do it...?
-
- Vempally
- February 06, 2016
- Like
- 0
- Continue reading or reply
Regarding Governer Limits for List and SOQL...
Hi everyone,
As we know that, SOQL can fetch a max of 50,000 records in a single execution...and
a List can store upto 1000 records...
Now,
List<Account> lst_acc = new List<Account>([Select id, name from Account]);
If the SOQL gives me more than 1000 records, how can I store them to the List.
As we know that, SOQL can fetch a max of 50,000 records in a single execution...and
a List can store upto 1000 records...
Now,
List<Account> lst_acc = new List<Account>([Select id, name from Account]);
If the SOQL gives me more than 1000 records, how can I store them to the List.
-
- Vempally
- February 04, 2016
- Like
- 0
- Continue reading or reply
Can anyone help in writting a test class for the following code...
public with sharing class WrapPractice { public List<Wrapper> wrap_lst {get; set;} public List<Account> acc_lst {get; set;} public List<Wrapper> selected_lst {get; set;} public PageReference showSelected() { selected_lst = new List<Wrapper>(); for(Wrapper w: wrap_lst) if(w.chk == true) selected_lst.add(w); system.debug(selected_lst); String lst_serialize = json.serialize(selected_lst); system.debug('serialised string ' + lst_serialize); Pagereference pg = page.show_accounts; pg.getParameters().put('lst_serialize', lst_serialize); return pg; } public WrapPractice(){ acc_lst = new List<Account>(); acc_lst = [select id, name, accountnumber from Account]; system.debug('Account List :'+ acc_lst); wrap_lst = new List<Wrapper>(); for(Account acc : acc_lst) wrap_lst.add(new Wrapper(acc)); system.debug('wraplist'+ wrap_lst); } Public Class Wrapper{ public Boolean chk {get; set;} public Account acc {get; set;} public Wrapper (Account acc){ this.acc = acc; chk = false; } } }
VisualForce
<apex:page controller="WrapPractice"> <apex:form > <apex:pageBlock > <apex:pageBlockSection > <apex:commandButton value="show" action="{!showSelected}"/> <apex:pageBlockTable value="{!wrap_lst}" var="w"> <apex:column > <apex:inputCheckbox value="{!w.chk}"/> </apex:column> <apex:column > <apex:outputField value="{!w.acc.id}"/> </apex:column> <apex:column > <apex:outputField value="{!w.acc.name}"/> </apex:column> <apex:column > <apex:outputField value="{!w.acc.accountnumber}"/> </apex:column> </apex:pageBlockTable> <apex:pageBlockTable value="{!selected_lst}" var="slst"> <apex:column > <apex:inputCheckbox value="{!slst.chk}"/> </apex:column> <apex:column > <apex:outputField value="{!slst.acc.id}"/> </apex:column> <apex:column > <apex:outputField value="{!slst.acc.name}"/> </apex:column> <apex:column > <apex:outputField value="{!slst.acc.accountnumber}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
-
- Vempally
- January 24, 2016
- Like
- 0
- Continue reading or reply
Eclipse: Force.com IDE installation error
Hi everyone
Iam trying to install software in eclipse i.e., Force.com IDE from the repository
http://media.developerforce.com/force-ide/eclipse42/ which gives following error
An error occurred while collecting items to be installed
Unable to read repository at http://media.developerforce.com/force-ide/eclipse42/plugins/com.salesforce.ide.apex.core_33.0.0.201504091124.jar.
Read timed out
Iam trying to install software in eclipse i.e., Force.com IDE from the repository
http://media.developerforce.com/force-ide/eclipse42/ which gives following error
An error occurred while collecting items to be installed
Unable to read repository at http://media.developerforce.com/force-ide/eclipse42/plugins/com.salesforce.ide.apex.core_33.0.0.201504091124.jar.
Read timed out
-
- Vempally
- September 23, 2015
- Like
- 0
- Continue reading or reply
Inner Classes of an apex class genarated from Partner WSDL
Hi everyone,
I have just started integrating two sfdc orgs...
All that I need is a clear understanding of the apex classes generated from partner wsdl...
The class generated contains many inner classes and I want a clear understanding of these...
Can Anyone refer me some related docs ...
I have just started integrating two sfdc orgs...
All that I need is a clear understanding of the apex classes generated from partner wsdl...
The class generated contains many inner classes and I want a clear understanding of these...
Can Anyone refer me some related docs ...
-
- Vempally
- May 25, 2015
- Like
- 0
- Continue reading or reply
Given Accountid, SOQL not retrieving Contacts
Hi Folks,
Plz check with the following code of a class for custom button on Account..
I need to get the contacts when account id is passed through the custom button to a global class.
Plz check with the following code of a class for custom button on Account..
I need to get the contacts when account id is passed through the custom button to a global class.
Global class AccountContactFieldUpdate{ public static Id accountid; public static List<Account> lst_acc; webservice static void contactFieldsConcat(Id accid){ accountid = accid; string query ='select id, name, (select id, name from Contacts) from account where id =: accountid'; lst_acc = Database.query(query); system.debug(lst_acc); } }
-
- Vempally
- May 18, 2015
- Like
- 0
- Continue reading or reply
Regarding the Custom Field creation Wizard
Hi Folks,
Whenever we create a custom field we go through 4 different pages where we start with
selecting the datatype -->CLICK NEXT --> Give name and label -->CLICK NEXT--> Security-->CLICK NEXT--> and finally select pagelayout and save.
why 4 different pages why not in a single page...?
Whenever we create a custom field we go through 4 different pages where we start with
selecting the datatype -->CLICK NEXT --> Give name and label -->CLICK NEXT--> Security-->CLICK NEXT--> and finally select pagelayout and save.
why 4 different pages why not in a single page...?
-
- Vempally
- May 16, 2015
- Like
- 0
- Continue reading or reply
Relatedlist even without any relationship...
Hi everyone,
My doubt maybe stupid but what i want to know is... can we get the relatedlist in a record detail page even if there is no relationship existing with any sobject...?
My doubt maybe stupid but what i want to know is... can we get the relatedlist in a record detail page even if there is no relationship existing with any sobject...?
-
- Vempally
- May 05, 2015
- Like
- 0
- Continue reading or reply
Updating the picklist values in the modal...
Hi Everyone,
I have a multiselect picklist with values 1 to 10
I have selected 1, 2, 8 and saved the first record.
For the next record I should not see the values 1, 2, 8 as they are already got selected and saved for the first record.
This needs to be achieved in the modal and not on VF.
I have a multiselect picklist with values 1 to 10
I have selected 1, 2, 8 and saved the first record.
For the next record I should not see the values 1, 2, 8 as they are already got selected and saved for the first record.
This needs to be achieved in the modal and not on VF.
-
- Vempally
- April 30, 2015
- Like
- 0
- Continue reading or reply
Overriding a Page for Some, but not All, Users
Hi Everyone,
I've found the code for this at the following link,
http://developer.force.com/cookbook/recipe/overriding-a-page-for-some-but-not-all-users
but not able to understand the following "IF statement"
can anyone explain me what is happening in IF statement...
Iam a NEWBIE...
regards,
Suresh.
I've found the code for this at the following link,
http://developer.force.com/cookbook/recipe/overriding-a-page-for-some-but-not-all-users
but not able to understand the following "IF statement"
<apex:page action= "{!if($Profile.Name !='System Administrator', null, urlFor($Action.Account.Tab, $ObjectType.Account, null, true))}" standardController="Account" recordSetVar="accounts" tabStyle="Account"> <!-- Replace with your markup --> This page replaces your Account home page for all users except Administrators. </apex:page>
can anyone explain me what is happening in IF statement...
Iam a NEWBIE...
regards,
Suresh.
-
- Vempally
- March 04, 2016
- Like
- 1
- Continue reading or reply
Issue with the Shopping Cart Functionality in e-Commerce project
Hai Everyone...
Iam working on an e-commerce project and facing problem in shopping cart module as follows...
Adding and deleting products into and from the cart is working good...
but when we close the app and open it again from the the same system the cart becomes empty which should not happen...
the cart should contain the added products in it...
cart is not an sObject...
How to achieve this...?
Iam working on an e-commerce project and facing problem in shopping cart module as follows...
Adding and deleting products into and from the cart is working good...
but when we close the app and open it again from the the same system the cart becomes empty which should not happen...
the cart should contain the added products in it...
cart is not an sObject...
How to achieve this...?
-
- Vempally
- June 05, 2014
- Like
- 1
- Continue reading or reply
need help with the following trigger
Hi everyone...
In the for loop where iam retrieving contacts based on an account, when SOQL is used its working fine but when the soql is replaced with a a.contacts the for loop is not getting executed... Why...?
trigger CustomRollupSummary on Contact (after insert, after update, after delete, after undelete) { if(trigger.isInsert && Trigger.isAfter){ List<Account> lst_accounts = new list<Account>(); //decimal Value =0; set<id> account_ids = new set<id>(); for(Contact c : trigger.new){ account_ids.add(c.accountid); system.debug('account_ids' + account_ids); } Map<id, Account> map_accounts = new Map<id, Account>([select id, name from Account where id in : account_ids]); system.debug('map_accounts' + map_accounts); system.debug('map_accounts' + map_accounts.values()); for(Account a : map_accounts.values()){ system.debug('account' + a); a.Amount_Sum__c = 0; //for(Contact c :[select id, name, amount__c from contact where accountid =: a.Id]) for(Contact c : a.contacts) { system.debug('Contact' + c); a.Amount_Sum__c += c.amount__c; } lst_accounts.add(a); } system.debug('updated accounts' + lst_accounts); update lst_accounts; } /* List<Contact> lst_contacts = new List<Contact>(); for(Account a : lst_account){ lst_contacts.add(a.contacts); system.debug('lst_contacts'); */ }
In the for loop where iam retrieving contacts based on an account, when SOQL is used its working fine but when the soql is replaced with a a.contacts the for loop is not getting executed... Why...?
- Vempally
- March 27, 2016
- Like
- 0
- Continue reading or reply
Required Trigger on child accessing parent field and updating parent.
Hi Everyone,
Can anyone give the code and explanation where i need to udate parent field with the value calculated with child fields.
Eg: Rollup Summary for Sum(). Need trigger code fro this for understanding.
Can anyone give the code and explanation where i need to udate parent field with the value calculated with child fields.
Eg: Rollup Summary for Sum(). Need trigger code fro this for understanding.
- Vempally
- February 29, 2016
- Like
- 0
- Continue reading or reply
Can anyone help in writting a test class for the following code...
public with sharing class WrapPractice { public List<Wrapper> wrap_lst {get; set;} public List<Account> acc_lst {get; set;} public List<Wrapper> selected_lst {get; set;} public PageReference showSelected() { selected_lst = new List<Wrapper>(); for(Wrapper w: wrap_lst) if(w.chk == true) selected_lst.add(w); system.debug(selected_lst); String lst_serialize = json.serialize(selected_lst); system.debug('serialised string ' + lst_serialize); Pagereference pg = page.show_accounts; pg.getParameters().put('lst_serialize', lst_serialize); return pg; } public WrapPractice(){ acc_lst = new List<Account>(); acc_lst = [select id, name, accountnumber from Account]; system.debug('Account List :'+ acc_lst); wrap_lst = new List<Wrapper>(); for(Account acc : acc_lst) wrap_lst.add(new Wrapper(acc)); system.debug('wraplist'+ wrap_lst); } Public Class Wrapper{ public Boolean chk {get; set;} public Account acc {get; set;} public Wrapper (Account acc){ this.acc = acc; chk = false; } } }
VisualForce
<apex:page controller="WrapPractice"> <apex:form > <apex:pageBlock > <apex:pageBlockSection > <apex:commandButton value="show" action="{!showSelected}"/> <apex:pageBlockTable value="{!wrap_lst}" var="w"> <apex:column > <apex:inputCheckbox value="{!w.chk}"/> </apex:column> <apex:column > <apex:outputField value="{!w.acc.id}"/> </apex:column> <apex:column > <apex:outputField value="{!w.acc.name}"/> </apex:column> <apex:column > <apex:outputField value="{!w.acc.accountnumber}"/> </apex:column> </apex:pageBlockTable> <apex:pageBlockTable value="{!selected_lst}" var="slst"> <apex:column > <apex:inputCheckbox value="{!slst.chk}"/> </apex:column> <apex:column > <apex:outputField value="{!slst.acc.id}"/> </apex:column> <apex:column > <apex:outputField value="{!slst.acc.name}"/> </apex:column> <apex:column > <apex:outputField value="{!slst.acc.accountnumber}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
- Vempally
- January 24, 2016
- Like
- 0
- Continue reading or reply
Compile Error: unexpected token: 'public with sharing class
Hi all,
Can you pls help me with the below errors i am getting. I am just trying to replace a field with a different field in the VF page. I have made all the necessary changes in Controller and helper class but i get this error in the first line :- Compile Error: unexpected token: 'public with sharing class at line 1 column 0 both controller and helper classs pls help.


Pls Help.. Thanks in advance.Any help is highly appreciated
Thanks!!
Can you pls help me with the below errors i am getting. I am just trying to replace a field with a different field in the VF page. I have made all the necessary changes in Controller and helper class but i get this error in the first line :- Compile Error: unexpected token: 'public with sharing class at line 1 column 0 both controller and helper classs pls help.
Pls Help.. Thanks in advance.Any help is highly appreciated
Thanks!!
- Abraham kumar 4
- May 25, 2015
- Like
- 0
- Continue reading or reply
Need help in access inner class in apex
public class A{
public class B {
}
public class C {
public A.B show(){}
}
}
------------
Look above exampe. I have one inner class C.I need to create instance of that class.
Can any one help me to create instance of class C and call method show of class C.
- Hetal Sheth
- May 25, 2015
- Like
- 0
- Continue reading or reply
Get Picklist Value into Text field
Hello friends
I have workflow rule on Opportunity . In Account , I have custom field IsStage, Data Type=Text
In workflow , action item =field Update, if StageName=Closed Won then this value should reflect in IsStage.
I have wriiten as follows but is show error. Can anyone let me know?
Account.IsStage__c = CONTAINS(StageName, "Closed Won")
Regards
Krishna
I have workflow rule on Opportunity . In Account , I have custom field IsStage, Data Type=Text
In workflow , action item =field Update, if StageName=Closed Won then this value should reflect in IsStage.
I have wriiten as follows but is show error. Can anyone let me know?
Account.IsStage__c = CONTAINS(StageName, "Closed Won")
Regards
Krishna
- krishna casukhela 7
- March 24, 2015
- Like
- 0
- Continue reading or reply
Dependent Picklist value in Apex
Hi folks,
Can anyone tell me how to get the dependent picklist values based on the Controlling picklist value in Apex?
I need a sample code for that..
Thanks in advance
Karthick
Can anyone tell me how to get the dependent picklist values based on the Controlling picklist value in Apex?
I need a sample code for that..
Thanks in advance
Karthick
- SS Karthick
- November 19, 2014
- Like
- 0
- Continue reading or reply
What are case-insensitive in Apex ?
Hi guys.
I started to learn Apex recently.
Then I found that many things can be write with case insensitive character.
Such as:
Just to make sure, are there other case-insensitive things that can be happen on Apex ?
I started to learn Apex recently.
Then I found that many things can be write with case insensitive character.
Such as:
- Object name:
- You can write
public pagereference method1() { ..}
instead of -
public PageReference method1() { ..}
- You can write
- Variable name
- This will be compile error
-
Integer I; Integer i;
- SOQL and SOSL statements
-
Account[] accts = [sELect ID From ACCouNT where nAme = 'fred'];
-
Just to make sure, are there other case-insensitive things that can be happen on Apex ?
- Arufian
- November 07, 2014
- Like
- 0
- Continue reading or reply
Print list in visual force page
Hi,
i am trying to print the campaign member list in my vf page but it's giving me an error
Can anyone please help me?
below is my code..
<apex:page StandardController="Campaign" extensions="CampaignMemController">
<apex:form >
<apex:pageBlock title="Campaign Members Details" mode="maindetail">
<apex:pageBlockSection title="Campaign Members" id="cm3">
<apex:pageblocktable value="{!cm}" var="lead">
<apex:column headerValue="Name">
<apex:outputfield value="{!lead.Id}" />
</apex:column>
</apex:pageblocktable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public with sharing class CampaignMemController {
public Campaign camp {get; set; }
list<contact> con = [SELECT id FROM contact];
list<campaignmember> cmlist = [SELECT id, contactid FROM campaignmember];
list<contact> conlist = new list<contact>();
public CampaignMemController(ApexPages.StandardController controller) {
camp = (Campaign)controller.getRecord();
for(campaignmember cm : cmlist)
{
for(contact c : con)
{
if(c.id == cm.contactid)
conlist.add(c);
}
//System.debug('All the campaignmemebers under contact '+con.name+'are'+camList );
}
}
}
i am trying to print the campaign member list in my vf page but it's giving me an error
Can anyone please help me?
below is my code..
<apex:page StandardController="Campaign" extensions="CampaignMemController">
<apex:form >
<apex:pageBlock title="Campaign Members Details" mode="maindetail">
<apex:pageBlockSection title="Campaign Members" id="cm3">
<apex:pageblocktable value="{!cm}" var="lead">
<apex:column headerValue="Name">
<apex:outputfield value="{!lead.Id}" />
</apex:column>
</apex:pageblocktable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public with sharing class CampaignMemController {
public Campaign camp {get; set; }
list<contact> con = [SELECT id FROM contact];
list<campaignmember> cmlist = [SELECT id, contactid FROM campaignmember];
list<contact> conlist = new list<contact>();
public CampaignMemController(ApexPages.StandardController controller) {
camp = (Campaign)controller.getRecord();
for(campaignmember cm : cmlist)
{
for(contact c : con)
{
if(c.id == cm.contactid)
conlist.add(c);
}
//System.debug('All the campaignmemebers under contact '+con.name+'are'+camList );
}
}
}
- Rajashri
- November 07, 2014
- Like
- 0
- Continue reading or reply
Blackout the Background
Hi Team
I have a question so i am using <apex:outputlable> to display a label in the UI. So how can i make the background of entire lable to Black.??
Should i write css or is there any attribue in outputlable that support my requirement..Please let me know..Thanks in advance
I have a question so i am using <apex:outputlable> to display a label in the UI. So how can i make the background of entire lable to Black.??
Should i write css or is there any attribue in outputlable that support my requirement..Please let me know..Thanks in advance
- Venkata Dharanesh Babu Akkem
- November 07, 2014
- Like
- 0
- Continue reading or reply
render vf page
i reuire that when i click on edit button (on right hand side) then only it shud show save button but its showing save button before only.
how to do that.
<apex:commandLink value="Edit" action="{!enabledEditMode1}" style="margin-left: 69%">
<apex:actionSupport event="onclick" reRender="panel1"/>
</apex:commandLink>
</div>
<div class="panel-body">
<apex:outputPanel id="panel1">
<apex:commandButton action="{!save}" value="Save"/>
<apex:outputfield value="{!account.Email__c}" style="margin-left: 60%"></apex:outputfield>
<apex:inputField value="{!account.Email__c}" rendered="{!isEdit1}" style="margin-left: 60%"></apex:inputField>
</apex:outputPanel>
</div>
- Chitral Chadda
- October 15, 2014
- Like
- 0
- Continue reading or reply
From Visualforce controller code is overlapping
Hi,
Could anyone prapose any setting/solution for below?
While writing the "Visualforce" page code given a controller & methods which are not created.
After it shown the error and option to create,Clicked on the option to created the expected code.
When move that tab the autogenerated code is overlapping & not in readable format.

Could anyone prapose any setting/solution for below?
While writing the "Visualforce" page code given a controller & methods which are not created.
After it shown the error and option to create,Clicked on the option to created the expected code.
When move that tab the autogenerated code is overlapping & not in readable format.
- Deepika km
- July 27, 2014
- Like
- 0
- Continue reading or reply
How to access the Campaign field from lead object to visualforce
Hi All,
I want to access campaign field from lead object to visualforce using custom controller. For this,is the right way to write trigger? Suppose If I write trigger then how to call trigger from visualforce?
Kindly support and suggest.
Thank You.
I want to access campaign field from lead object to visualforce using custom controller. For this,is the right way to write trigger? Suppose If I write trigger then how to call trigger from visualforce?
Kindly support and suggest.
Thank You.
- Keerthigee
- July 15, 2014
- Like
- 0
- Continue reading or reply
Formula to rearrange characters in a text field
Hi all,
is there a formula I can use to rearrange characters in a text value?
The current text value = 890412
The formaula should change to = 12/04/89
Thanks
is there a formula I can use to rearrange characters in a text value?
The current text value = 890412
The formaula should change to = 12/04/89
Thanks
- Andrew Hoban 6
- April 30, 2015
- Like
- 1
- Continue reading or reply
How to update a multi-picklist on contact/lead based on a campaign field?
Hello,
I am a Salesforce admin with no development knowledge.
I would need some help with the following:
I am trying to update a multipicklist on lead/contact object after they become members of a campaign (of a certain record type). The campaign has a multipicklist with certains values and I want to add these values to the multipicklist of the lead/contact without deleting the values that were already stored in the field previously.
I'm not sure if that's clear... Any help would be greatly appreciated.
Many thanks.
I am a Salesforce admin with no development knowledge.
I would need some help with the following:
I am trying to update a multipicklist on lead/contact object after they become members of a campaign (of a certain record type). The campaign has a multipicklist with certains values and I want to add these values to the multipicklist of the lead/contact without deleting the values that were already stored in the field previously.
I'm not sure if that's clear... Any help would be greatly appreciated.
Many thanks.
- Stéphanie Park
- April 30, 2015
- Like
- 1
- Continue reading or reply
I want to add a pop up window on click when account is not selected
hi All,
I want to add a pop up window on click when account is not selected. this is a list view page of account. and i am adding a custom button there.
I want to add a pop up window on click when account is not selected. this is a list view page of account. and i am adding a custom button there.
- Parteek Goyal 3
- April 30, 2015
- Like
- 1
- Continue reading or reply