-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
49Questions
-
39Replies
Avoid the system address fields of contact populated automatically when created from an account
Need to avoid the system address fields being populated with Account address automatically whenever we create a contact from account page.
Whenever a contact is being created from an account page the account field is populated automatically and the system address field of contact are populated by account address.
Tried overriding the create contact button with scontrol and javascript, but whenever the account is passed while creating a contact the address fields gets populated automatically.
Please let me know if any soln?
Thanks
shaan
- VF
- July 13, 2011
- Like
- 0
- Continue reading or reply
Avoid the system address fields of contact populated automatically when created from an account
Need to avoid the system address fields being populated with Account address automatically whenever we create a contact from account page.
Whenever a contact is being created from an account page the account field is populated automatically and the system address field of contact are populated by account address.
Tried overriding the create contact button with scontrol and javascript, but whenever the account is passed while creating a contact the address fields gets populated automatically.
Please let me know if any soln?
Thanks
shaan
- VF
- July 13, 2011
- Like
- 0
- Continue reading or reply
Enable edit functionality on VF page
There is a VF page in which we are using extensions along with the standard controller of an standard object(say account).
For a particular Profile the Create\Edit functionality of the standard object has been removed.
So whenever the user of that particular profile logs in hes not able to edit anything in VF Page where the extension for a standard controller is being used.
Please help me how to give edit access on VF page keeping the profile level settings intact.
REgards,
shaan
- VF
- June 28, 2011
- Like
- 0
- Continue reading or reply
Trigger Test class
Hello,
I have an issue in Apex triggers can any one help me out: I have a lraedy made two post but didnot get any reply .please help me out as it is very urjent for me.
Here is the code of my Apex trigger test class:
public class sampleTest{
static testMethod void WCSFTrigger(){
Map<String, Individual_Email_Results__c> lgaMap = new Map<String, Individual_Email_Results__c>();
Individual_Email_Results__c objInsert = new Individual_Email_Results__c();
objInsert .Hard_Bounce__c = 1;
objInsert .Abuse__c = '1';
objInsert .GlobalUnsubscribe__c = '1';
objInsert .UniversalUnsubscribe__c = '1';
objInsert .Unsubscribe__c = '1';
objInsert .Lead__c = '00Q90000001S4fL';
objInsert .Contact__c = '00390000001bZ1V';
insert objInsert ;
//Here the triggers fires on updation
objInsert . Unsubscribe__c = '3';
update objInsert;
Decimal newValue = objInsert .Hard_Bounce__c;//obj.Hard_Bounce__c;
Decimal oldValue = 2;
String contactID = objInsert.Contact__c;//'00390000001bZ1V';
String leadID = objInsert.Lead__c;
system.debug(objInsert.Contact__c);
if(newValue != oldValue)
{
system.debug(contactID);
if(contactID != null)
{
Contact contact = [Select Id, HasOptedOutOfEmail from contact WHERE Id=: contactID ];
system.debug(contact);
system.debug(contact.HasOptedOutOfEmail);
if(contact.HasOptedOutOfEmail == true)
{
contact.HasOptedOutOfEmail = false;
//system.assertEquals(contact.HasOptedOutOfEmail , false);
}
else
{
contact.HasOptedOutOfEmail = true;
//system.assertEquals(contact.HasOptedOutOfEmail , true);
}
update contact;
}
if(objInsert.Lead__c!= null)
{
Lead lead = [Select Id, HasOptedOutOfEmail from lead WHERE Id=:objInsert.Lead__c];
if(lead .HasOptedOutOfEmail == true)
{
system.assertEquals(lead .HasOptedOutOfEmail , true);
}
else
{
system.assertEquals(lead .HasOptedOutOfEmail , true);
}
update lead ;
}
if( (objInsert.Abuse__c != '2') || (objInsert.GlobalUnsubscribe__c != '2') || (objInsert.UniversalUnsubscribe__c != '2') || (objInsert.Unsubscribe__c != '2'))
{
if(objInsert.Contact__c!= null)
{
Contact contact = [Select Id, EmailBouncedDate , EmailBouncedReason from contact WHERE Id=:objInsert.Contact__c];
system.assertEquals( contact.EmailBouncedReason , 'WhatCounts Hard Bounce');
update contact;
}
if(objInsert.Lead__c!= null)
{
Lead lead= [Select Id, EmailBouncedDate , EmailBouncedReason from lead WHERE Id=:objInsert.Lead__c];
system.assertEquals( lead.EmailBouncedReason , 'WhatCounts Hard Bounce');
update lead;
}
}
}
I have a problem in writing test class for code which has bold font .Please let me know if there is any issue.
The trigger is:
trigger WCSFTrigger on Individual_Email_Results__c (after update) {
Map<String, Individual_Email_Results__c> lgaMap = new Map<String, Individual_Email_Results__c>();
for (Individual_Email_Results__c objUpdate: System.Trigger.New) {
Individual_Email_Results__c obj= [Select id,Contact__c,Lead__c,Hard_Bounce__c,Abuse__c,GlobalUnsubscribe__c,UniversalUnsubscribe__c,Unsubscribe__c,Hard_Bounce_Event_Date__c from Individual_Email_Results__c where id= :objUpdate.Id];
string contactID = obj.Contact__c;
string leadID = obj.Lead__c;
Decimal newValue = trigger.new[0].Hard_Bounce__c;
Decimal oldValue = trigger.old[0].Hard_Bounce__c;
if(newValue != oldValue )
{
if(contactID != null)
{
Contact contact = [Select Id, HasOptedOutOfEmail from contact WHERE Id=:contactID ];
if(contact.HasOptedOutOfEmail == true)
{
contact.HasOptedOutOfEmail = false;
}
else
{
contact.HasOptedOutOfEmail = true;
}
update contact;
}
if(leadId != null)
{
Lead lead = [Select Id, HasOptedOutOfEmail from lead WHERE Id=: leadId];
if(lead.HasOptedOutOfEmail == true)
{
lead.HasOptedOutOfEmail = false;
}
else
{
lead.HasOptedOutOfEmail = true;
}
update lead;
}
}
if( (trigger.new[0].Abuse__c != trigger.old[0].Abuse__c) || (trigger.new[0].GlobalUnsubscribe__c != trigger.old[0].GlobalUnsubscribe__c) || (trigger.new[0].UniversalUnsubscribe__c != trigger.old[0].UniversalUnsubscribe__c) || (trigger.new[0].Unsubscribe__c != trigger.old[0].Unsubscribe__c))
{
if(contactID != null)
{
Contact contact = [Select Id, EmailBouncedDate , EmailBouncedReason from contact WHERE Id=:contactID ];
contact.EmailBouncedReason = 'WhatCounts Hard Bounce';
contact.EmailBouncedDate = datetime.valueOf(obj.Hard_Bounce_Event_Date__c);
update contact;
}
if(leadId != null)
{
Lead lead= [Select Id, EmailBouncedDate , EmailBouncedReason from lead WHERE Id=:leadID ];
lead.EmailBouncedReason = 'WhatCounts Hard Bounce';
lead.EmailBouncedDate = datetime.valueOf(obj.Hard_Bounce_Event_Date__c);
update lead;
}
}
}
}
Please let me know if any changes has to be done.
I have followed the APEX DOCS TO WRITE THE CODE. I have already made two posts regarding this issue but didnot get any reply.
Thanks
- VF
- December 12, 2009
- Like
- 0
- Continue reading or reply
IDE problem
- VF
- December 12, 2009
- Like
- 0
- Continue reading or reply
IDE problem
- VF
- December 12, 2009
- Like
- 0
- Continue reading or reply
code coverage for the below code
- VF
- December 11, 2009
- Like
- 0
- Continue reading or reply
code coverage test class for a trigger
Hello,
Here is the trigger which i have written:
This trigger used to update the contact fields when any custom field is updated.
I wrote a test case for the below trigger for that:
I am getting a code coverage of 6% . can any one help me to get the code coverage.
trigger WCSFTrigger on Individual_Email_Results__c (after update) {
Map<String, Individual_Email_Results__c> lgaMap = new Map<String, Individual_Email_Results__c>();
for (Individual_Email_Results__c objUpdate: System.Trigger.New) {
Individual_Email_Results__c obj= [Select id,Contact__c,Lead__c,Hard_Bounce__c,Abuse__c,GlobalUnsubscribe__c,UniversalUnsubscribe__c,Unsubscribe__c,Hard_Bounce_Event_Date__c from Individual_Email_Results__c where id= :objUpdate.Id];
string contactID = obj.Contact__c;
string leadID = obj.Lead__c;
Decimal newValue = trigger.new[0].Hard_Bounce__c;
Decimal oldValue = trigger.old[0].Hard_Bounce__c;
if(newValue != oldValue)
{
if(contactID != null)
{
Contact contact = [Select Id, HasOptedOutOfEmail from contact WHERE Id=:contactID ];
if(contact.HasOptedOutOfEmail == true)
{
contact.HasOptedOutOfEmail = false;
}
else
{
contact.HasOptedOutOfEmail = true;
}
update contact;
}
if(leadId != null)
{
Lead lead = [Select Id, HasOptedOutOfEmail from lead WHERE Id=: leadId];
if(lead.HasOptedOutOfEmail == true)
{
lead.HasOptedOutOfEmail = false;
}
else
{
lead.HasOptedOutOfEmail = true;
}
update lead;
}
}
if( (trigger.new[0].Abuse__c != trigger.old[0].Abuse__c) || (trigger.new[0].GlobalUnsubscribe__c != trigger.old[0].GlobalUnsubscribe__c) || (trigger.new[0].UniversalUnsubscribe__c != trigger.old[0].UniversalUnsubscribe__c) || (trigger.new[0].Unsubscribe__c != trigger.old[0].Unsubscribe__c))
{
if(contactID != null)
{
Contact contact = [Select Id, EmailBouncedDate , EmailBouncedReason from contact WHERE Id=:contactID ];
contact.EmailBouncedReason = 'WhatCounts Hard Bounce';
contact.EmailBouncedDate = datetime.valueOf(obj.Hard_Bounce_Event_Date__c);
update contact;
}
if(leadId != null)
{
Lead lead= [Select Id, EmailBouncedDate , EmailBouncedReason from lead WHERE Id=:leadID ];
lead.EmailBouncedReason = 'WhatCounts Hard Bounce';
lead.EmailBouncedDate = datetime.valueOf(obj.Hard_Bounce_Event_Date__c);
update lead;
}
}
}
}
Now here is the Test class for the trigger:
public class sampleTest{
static testMethod void WCSFTrigger(){
Map<String, Individual_Email_Results__c> lgaMap = new Map<String, Individual_Email_Results__c>();
Individual_Email_Results__c objInsert = new Individual_Email_Results__c();
//List<IndividualEmailResult__c> itemsToInsert = new List<IndividualEmailResult__c>();
objInsert .Hard_Bounce__c = 1;
objInsert .Abuse__c = '1';
objInsert .GlobalUnsubscribe__c = '1';
objInsert .UniversalUnsubscribe__c = '1';
objInsert .Unsubscribe__c = '1';
objInsert .Lead__c = '00Q90000001S4fL';
objInsert .Contact__c = '00390000001bZ1V';
//itemsToInsert.add(objInsert );
insert objInsert ;
Individual_Email_Results__c obj= [Select id,Contact__c,Lead__c,Hard_Bounce__c,Abuse__c,GlobalUnsubscribe__c,UniversalUnsubscribe__c,Unsubscribe__c,Hard_Bounce_Event_Date__c from Individual_Email_Results__c where id= :objInsert .Id];
Decimal newValue = obj.Hard_Bounce__c;
Decimal oldValue = 2;
if(newValue != oldValue)
{
if(obj.Contact__c!= null)
{
Contact contact = [Select Id, HasOptedOutOfEmail from contact WHERE Id=:obj.Contact__c];
if(contact.HasOptedOutOfEmail == true)
{
system.assertEquals(contact.HasOptedOutOfEmail , true);
}
else
{
system.assertEquals(contact.HasOptedOutOfEmail , true);
}
update contact;
}
if(obj.Lead__c!= null)
{
Lead lead = [Select Id, HasOptedOutOfEmail from lead WHERE Id=:obj.Lead__c];
if(lead .HasOptedOutOfEmail == true)
{
system.assertEquals(lead .HasOptedOutOfEmail , true);
}
else
{
system.assertEquals(lead .HasOptedOutOfEmail , true);
}
update lead ;
}
if( (obj.Abuse__c != '2') || (obj.GlobalUnsubscribe__c != '2') || (obj.UniversalUnsubscribe__c != '2') || (obj.Unsubscribe__c != '2'))
{
if(obj.Contact__c!= null)
{
Contact contact = [Select Id, EmailBouncedDate , EmailBouncedReason from contact WHERE Id=:obj.Contact__c];
system.assertEquals( contact.EmailBouncedReason , 'WhatCounts Hard Bounce');
//system.assertEquals( contact.EmailBouncedDate , datetime.valueOf('2009-11-24 10:26:00') );
update contact;
}
if(obj.Lead__c!= null)
{
Lead lead= [Select Id, EmailBouncedDate , EmailBouncedReason from lead WHERE Id=:obj.Lead__c];
system.assertEquals( lead.EmailBouncedReason , null);
//system.assertEquals( lead.EmailBouncedDate , datetime.valueOf('2009-11-24 10:26:00') );
update lead;
}
}
}
}
}
Thanks
shaan
- VF
- December 11, 2009
- Like
- 0
- Continue reading or reply
Update Trigger
Hello,
I wrote a trigger to change a contact field when an custom object is updated .
code:
trigger Test on Individual_Email_Results__c (after insert, after update) { |
Now i want to write the same trigger only when the Custom field is updated.
Here the custom field is : Hard_Bounce__c
for the custom object.
Please help me out this very much urjent for me.
Your help is appreciated always.
Thanks
shaan
- VF
- November 30, 2009
- Like
- 0
- Continue reading or reply
Apex trigger
Hello,
I have an custom object which has relation with campaign . In that i have a field , if i update the field from the object then the EmailOptout standard field from contact or lead should change.
Can any one help me in writing an apex trigger for this.
- VF
- November 30, 2009
- Like
- 0
- Continue reading or reply
Issue regarding governor limits
Hello,
I am facing an error while running the Apex code as:
System.Exception: Too many SOQL queries: 10001
Can anyone provide me with a solution for this.
I went through the docs and the discussions for the governor limits but got confused by the posts .
Could any one provide a solution to this :
Your help will be appreciated ....
Thanks
shaan
- VF
- November 17, 2009
- Like
- 0
- Continue reading or reply
query in soql
- VF
- November 05, 2009
- Like
- 0
- Continue reading or reply
issue while using the metadata api
- VF
- October 31, 2009
- Like
- 0
- Continue reading or reply
issue while using the metadata api
- VF
- October 31, 2009
- Like
- 0
- Continue reading or reply
No: of users insatalled a partculr package
- VF
- September 24, 2009
- Like
- 0
- Continue reading or reply
No: of users who installes a package
- VF
- September 24, 2009
- Like
- 0
- Continue reading or reply
To store a list with more than 5000 records
Hello,
Can we add a total of nearly 5000 ids to a particular list of string type.If there is any method or soln please help me out.
Thanks
shaan
- VF
- September 10, 2009
- Like
- 0
- Continue reading or reply
collection exceeds maximum size: 1001
Hi ,
Below is the class which i am using to retrieve leadis and contactids from campaign which are a total of more then 2000 records from select query using for loop.
public class Test
{
Set<Id> leadid = new Set<Id>();
Set<Id> contactid = new Set<Id>();
List<String> emails=new List<String>();
public void TestMethod()
{
for(campaignmember camp:[Select leadid,contactid from campaignmember where campaignid=:'campaignId']) {
leadid.add(camp.leadid);
contactid.add(camp.contactid);
}
}
}
here i am able to run the query which has more than 2000 records in the for loop but unable to add the leadid and contactid to the List<Id> (i.e leadid , contactid) respectively as shown above.
An exception - collection exceeds maximum size: 1001 is being disaplayed.
My actual intenstion is to get the leadids and contactids and run the respective select query and add the email address to a list string emails.
for (Contact cnt: [Select Email from contact WHERE Id IN :contactid])
{
if(cnt.Email != null)
{
emails.add(cnt.Email);
}
}
can any one help me out.Thanks in advance
Thanks
prashanth.
- VF
- September 10, 2009
- Like
- 0
- Continue reading or reply
Problem regarding adding a lead and contact to a campaign
- VF
- September 02, 2009
- Like
- 0
- Continue reading or reply
Maintaining Time Zones
Hello,
I am using standard indian time zone(GMT+5:30) in my application.
Here i am using my sytem Time and saving the data into a database.
But if my client uses the same datetime from the same DB he should get his system time.
Can i maintain the standard time for both the time zones. if yes , could any one suggest me how to maintain the standard times between countries or else is there any other alternative.
Plaese help me out as its urjent for my application.
Thanks
shaan
- VF
- August 26, 2009
- Like
- 0
- Continue reading or reply
Enable edit functionality on VF page
There is a VF page in which we are using extensions along with the standard controller of an standard object(say account).
For a particular Profile the Create\Edit functionality of the standard object has been removed.
So whenever the user of that particular profile logs in hes not able to edit anything in VF Page where the extension for a standard controller is being used.
Please help me how to give edit access on VF page keeping the profile level settings intact.
REgards,
shaan
- VF
- June 28, 2011
- Like
- 0
- Continue reading or reply
IDE problem
- VF
- December 12, 2009
- Like
- 0
- Continue reading or reply
Update Trigger
Hello,
I wrote a trigger to change a contact field when an custom object is updated .
code:
trigger Test on Individual_Email_Results__c (after insert, after update) { |
Now i want to write the same trigger only when the Custom field is updated.
Here the custom field is : Hard_Bounce__c
for the custom object.
Please help me out this very much urjent for me.
Your help is appreciated always.
Thanks
shaan
- VF
- November 30, 2009
- Like
- 0
- Continue reading or reply
Apex trigger
Hello,
I have an custom object which has relation with campaign . In that i have a field , if i update the field from the object then the EmailOptout standard field from contact or lead should change.
Can any one help me in writing an apex trigger for this.
- VF
- November 30, 2009
- Like
- 0
- Continue reading or reply
Issue regarding governor limits
Hello,
I am facing an error while running the Apex code as:
System.Exception: Too many SOQL queries: 10001
Can anyone provide me with a solution for this.
I went through the docs and the discussions for the governor limits but got confused by the posts .
Could any one provide a solution to this :
Your help will be appreciated ....
Thanks
shaan
- VF
- November 17, 2009
- Like
- 0
- Continue reading or reply
No: of users insatalled a partculr package
- VF
- September 24, 2009
- Like
- 0
- Continue reading or reply
To store a list with more than 5000 records
Hello,
Can we add a total of nearly 5000 ids to a particular list of string type.If there is any method or soln please help me out.
Thanks
shaan
- VF
- September 10, 2009
- Like
- 0
- Continue reading or reply
collection exceeds maximum size: 1001
Hi ,
Below is the class which i am using to retrieve leadis and contactids from campaign which are a total of more then 2000 records from select query using for loop.
public class Test
{
Set<Id> leadid = new Set<Id>();
Set<Id> contactid = new Set<Id>();
List<String> emails=new List<String>();
public void TestMethod()
{
for(campaignmember camp:[Select leadid,contactid from campaignmember where campaignid=:'campaignId']) {
leadid.add(camp.leadid);
contactid.add(camp.contactid);
}
}
}
here i am able to run the query which has more than 2000 records in the for loop but unable to add the leadid and contactid to the List<Id> (i.e leadid , contactid) respectively as shown above.
An exception - collection exceeds maximum size: 1001 is being disaplayed.
My actual intenstion is to get the leadids and contactids and run the respective select query and add the email address to a list string emails.
for (Contact cnt: [Select Email from contact WHERE Id IN :contactid])
{
if(cnt.Email != null)
{
emails.add(cnt.Email);
}
}
can any one help me out.Thanks in advance
Thanks
prashanth.
- VF
- September 10, 2009
- Like
- 0
- Continue reading or reply
navigation to standard pages using Page reference method
Hello,
I am using the below code to redirect to the standard salesforce pages as:
public PageReference Save()
{
String newPageUrl = 'https://ap1.salesforce.com/701/o';
PageReference newPage = new PageReference(newPageUrl);
newPage.setRedirect(true);
return newPage;
}
This piece of code helps in navigating the page to campaign default page.Here the url-"https://ap1.salesforce.com/701/o" is the campaigns default page url for my account.
Instead of passing the complete url is there any way to redirect to sandard campaign page in pageReference method.
Thanks,
shaan
- VF
- August 11, 2009
- Like
- 0
- Continue reading or reply
issue in constructor method
In my class i have a constructor here i am calling a method in the constructor so as to redirect to another Vf page.
Here is the code:
class:
public class MyClass
{
public MyClass(ApexPages.StandardController controller)
{
ShowDetails();
}
public PageReference ShowDetails()
{
return page.MyPage;
}
}
is there any thing wrong in the code.Help me out guyz
Thanks shaan
- VF
- August 07, 2009
- Like
- 0
- Continue reading or reply
Action support for dropdowns
Hello i am using the action support method in order to fill a drop down on onchange event in another dropdown.The problem is that the values are being repeated in the dropdown.
elow is the design and code for the issue:
code:
<apex:selectList id="campaignIds" value="{!status}" size="1">
<apex:actionSupport event="onchange" reRender="statusid" action="{!getStatus}" status="status"/>
<apex:selectOption itemLabel="--None--" itemValue="--None--" ></apex:selectOption>
<!--<apex:actionSupport event="onchange" reRender="statusid" action="{!getItemsList}" status="status"/>-->
<apex:selectOptions value="{!items}"></apex:selectOptions>
</apex:selectList>
<apex:actionStatus id="status" startText="Loading..."></apex:actionStatus>
<apex:selectList id="statusid" size="1">
<apex:selectOption itemLabel="--None--" itemValue="--None--" ></apex:selectOption>
<apex:selectOptions value="{!itemsList}"></apex:selectOptions>
</apex:selectList>
</td>
here is the controller code for the above design:
public class CampaignCreation
{
List<Campaign> campaign = new List<Campaign>();
List<Selectoption> options = new List<Selectoption>();
List<Selectoption> optionsList = new List<Selectoption>();
List<CampaignMemberStatus> campMemberStatus = new List<CampaignMemberStatus>();
String campaignId = null;
private String pStatus= null;
public CampaignCreation(ApexPages.StandardController controller) {
}
public CampaignCreation()
{
//Campaign campaignobj = [select id,Name from Campaign where IsActive=true];
//CampaignMemberStatus campMemberStatus = [Select Label From CampaignMemberStatus WHERE CampaignId ='campaignId'];
}
public String status
{
get { return pStatus; }
set { pStatus= value; }
}
public List<SelectOption> getItems()
{
campaign = [select id,Name from Campaign where IsActive=true];
//String campaignId = campaign[0].Id;
for(Integer i=0;i< campaign.size();i++)
{
options.add(new SelectOption(String.valueOf(campaign[i].id),String.valueOf(campaign[i].Name)));
}
return options;
}
public List<SelectOption> getItemsList()
{
campMemberStatus = [Select Label From CampaignMemberStatus WHERE CampaignId =:pStatus];
system.debug(campMemberStatus.size());
for(Integer i=0;i< campMemberStatus.size();i++)
{
//this.pStatus = campaign[i].Id;
optionsList.add(new SelectOption( String.valueOf(campMemberStatus[i].Label),String.valueOf(campMemberStatus[i].Label)));
}
return optionsList;
}
public void getStatus()
{
getItemsList();
}
}
can any one help me out of this issue
Thanks,
shaan
- VF
- August 04, 2009
- Like
- 0
- Continue reading or reply
Dynamic binding of Data
- VF
- July 23, 2009
- Like
- 0
- Continue reading or reply