-
ChatterFeed
-
2Best Answers
-
1Likes Received
-
0Likes Given
-
11Questions
-
16Replies
extract or export via Apex Data Loader command line is over 300 times slower than expected
When I perform a certain export operation using the Apex Data Loader GUI, the operation takes about 10 seconds to complete.
When I attempt the exact same operation using the Apex Data Loader through the command line, the operation takes almost 1 hour to complete.
Has anyone else encountered this massive discrepancy? And does anyone have any ideas on how to speed up the command line operation?
-
- Marty Y. Chang
- April 18, 2011
- Like
- 0
- Continue reading or reply
Visualforce Table
-
- OnurK
- January 21, 2013
- Like
- 0
- Continue reading or reply
Visualforce table with dynamic header
Hi all,
I want to mak a table and would like to use the days of the month as header. For example in January there would be 31 columns and February 28 coumns etc. Column headers can be 1 , 2, 3, 4 or anything else. Is there anyone can share a sample code with me?
Thank you all in advance.
-
- OnurK
- January 14, 2013
- Like
- 0
- Continue reading or reply
Array vs List
Hi All,
Can anyone please explain me the difference between List and Array.
Test__c[] t = new Test__c[0];
vs
List<Test__c> t = new List<Test__c>();
Thanks
-
- OnurK
- October 27, 2011
- Like
- 1
- Continue reading or reply
SObject row does not allow errors
Can you helpm for adding the error message here? I am getting SObject row does not allow errors message
trigger beforeCase on Case (before insert, before update) {/* // List <Case> cs = Trigger.new; // TaxNumberDuplicate.checkDuplicates (cs); Set<String> taxNumber =new Set<String>(); for (Case c : trigger.new) { taxNumber.add(c.Tax_Number__c); } List<Case> duplicatecaseList = new List<Case>(); for(Case c : [SELECT id, Tax_Number__c, permit_duplicate__c FROM Case WHERE Tax_Number__c IN: TaxNumber]) duplicatecaseList.add(c); for(Case cs : duplicatecaseList){ if(trigger.isInsert){ if(duplicatecaseList.size()> 0 && cs.permit_duplicate__c == FALSE && cs.Tax_Number__c != Null){ cs.Tax_Number__c.addError('ERROR!!!!!'); } } else if(trigger.isUpdate){ if(duplicatecaseList.size()> 0 && cs.permit_duplicate__c == FALSE && cs.Tax_Number__c != Null && System.trigger.oldMap.get(cs.id).Tax_Number__c != System.trigger.newMap.get(cs.id).Tax_Number__c ){ cs.Tax_Number__c.addError('ERROR!!!!!'); } } } */ }
-
- OnurK
- September 28, 2011
- Like
- 0
- Continue reading or reply
Before insert CreatedById Error
Hi,
I have a custom field in Cases called Sales_Representative__c (Lookup to user). We want it to be updated by the OwnerID with the Region__c in User.Region__c
The code is a follows;
The Class
public with sharing class SalesRepRegion { public static void updateSalesRepresantativeID (List<Case> caseList) { Set<id> CaseIds = new Set<id>(); for(Case c: caseList){ CaseIds.add(c.CreatedById); } Map<Id, User> usersMap = new Map<Id, User>([Select Id, Region__c from User Where Id IN :CaseIds]); for (Case cs : caseList) { cs.Sales_Representative__c = usersMap.get(cs.CreatedById).id; cs.Region__c = usersMap.get(cs.id).Region__c; } } }
The trigger
trigger beforeCase on Case (before insert, before update) { List <Case> cs = Trigger.new; for (Case c: cs){ if(trigger.isInsert){ SalesRepRegion.updateSalesRepresantativeID(cs); } } }
Thank you for your help
-
- OnurK
- September 27, 2011
- Like
- 0
- Continue reading or reply
More than 1 before Case triggers
ı have more than 1 before trigger for the same object. Can anyone knows a good template for that? Both of them works great in Sandbox but I receive null pointer error from the test code.
-
- OnurK
- September 26, 2011
- Like
- 0
- Continue reading or reply
oldMap and newMap in Class
Hi All;
I have a class runs after trigger. I need my class not run after an update when the certain field not updated. (I need my trigger runs after tax number changes) In trigger body it is possible to accomplish this with;
System.trigger.oldMap.get(c.id).Tax_Number__c != System.trigger.newMap.get(c.id).Tax_Number__c )
I can not add this code in a class. There must be some other way we can compare old value vs new value in a class. Can anyone help me with the issue I have?
Thank you very much for your help.
-
- OnurK
- September 20, 2011
- Like
- 0
- Continue reading or reply
100% coverage in Sandbox none in Production
I have a class runs before insert cases. It checks the duplicated tax number. It works perfect in Sandbox but there is covearge problem in Production. Can anyone help with the issue?
Thanks
public class TaxNumberDuplicate{ public static void checkDuplicates (List<Case> caseList) { List<Case> duplicatecaseList = new List<Case>(); for (Case c : caseList) { duplicatecaseList = [SELECT id FROM Case WHERE Tax_Number__c =: c.Tax_Number__c]; } if(trigger.isInsert){ if(duplicatecaseList.size()> 0 && c.Permit_Duplicate__c== FALSE && c.Tax_Number__c != Null){ c.Tax_Number__c.addError('ERROR'); } } else if(trigger.isUpdate){ duplicatecaseList = [SELECT id FROM Case WHERE Tax_Number__c =: c.Tax_Number__c]; if(duplicatecaseList.size()> 0 && c.Permit_Duplicate__c == FALSE && c.Tax_Number__c != Null){ c.Tax_Number__c.addError('ERROR'); } } } }
-
- OnurK
- September 06, 2011
- Like
- 0
- Continue reading or reply
Test Code for Mass Submit for Approval Process
Hi Everyone,
I have a simple code that creates list view button to submit mass approval process. Can you please help me to write test code for this class?
Thank you in advance for your help.
public class massSubmitProcess{ ApexPages.StandardSetController setCon; public massSubmitProcess(ApexPages.StandardSetController controller) { setCon = controller; } public pageReference autoRun(){ List<Approval.ProcessRequest> requests = new List<Approval.ProcessRequest>(); for (Case cs : (Case[])setCon.getSelected()) { Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest( ); req.setComments('Submitted for approval. Please approve.'); req.setObjectId(cs.id); requests.add(req); cs.Mass_Submit__c = TRUE; update cs; } try{ Approval.process(requests); PageReference pageRef = new PageReference ('/apex/requesttab?save_new=1&sfdc.override=1'); pageRef.setRedirect(true); return pageRef; } catch (Exception e){ return null; } } }
-
- OnurK
- September 01, 2011
- Like
- 0
- Continue reading or reply
Messaging.SingleEmailMessage Test Code
This is my code, I am sending email to Installers, I need a test code for this. I wonder if anyone can help?
Thanks in advance.
trigger handleServiceEmail on Case (after update) { Set<Id> caseIds = new Set<Id>(); List<Case> cl = [SELECT id, Service__r.Installer__c, Case_Type__c FROM Case WHERE id IN: trigger.newMap.keyset()]; Id[] targetCaseIds = new Id[] {}; List<Messaging.SingleEmailMessage> email = new List<Messaging.SingleEmailMessage>(); for(Case c : cl){ if(c.Case_Type__c == 'Urgent') { caseIds.add(c.Service__r.Installer__c); targetCaseIds.add(c.id); OrgWideEmailAddress owa = [select id from OrgWideEmailAddress]; EmailTemplate template = [SELECT id FROM EmailTemplate WHERE DeveloperName = 'Urgent Email' LIMIT 1]; for(Contact contact :[SELECT id,Email FROM Contact WHERE AccountID IN: caseIds]){ Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); mail.setOrgWideEmailAddressId(owa.Id); mail.setTargetObjectId(contact.Id); mail.setTemplateID(template.ID); mail.setSaveAsActivity(false); mail.setWhatId(c.ID); email.add(mail); } } } Messaging.sendEmail(email); }
-
- OnurK
- January 04, 2011
- Like
- 0
- Continue reading or reply
Updating Lookup Field
Hi everyone,
I have US university names stored in Accounts. I also collect information from web-to-lead, "university name" is a drop down comes as a text field from web site to lead. Landing field in Leads is called 'University Name". (University_name__c) I would like to update lookup field "University" in Leads (University__c) (which is a lookup and connected to Accounts) by using the text value from University_name__c. Here is the code I am working with. I appreciate a lot if anyone can help.
trigger LeadAccount on Lead (before insert, before update) {
List<String> LeadUni = new List<String>();
//University_name__c is a text field in Leads
for(Lead ld : trigger.new)
if(ld.University_name__c != null)
LeadUni.add(ld.University_name__c);
//AccountMap stores Account id from University_name__c field because Account.Name = Lead.University_name__c.
Map<String, Account> AccountMap = new Map<String, Account>(
[SELECT id from Account where name IN: LeadUni]);
for(Lead ld : Trigger.new)
ld.University__c = AccountMap.get(ld.University_name__c).id;
}
Thanks
-
- OnurK
- August 29, 2010
- Like
- 0
- Continue reading or reply
Array vs List
Hi All,
Can anyone please explain me the difference between List and Array.
Test__c[] t = new Test__c[0];
vs
List<Test__c> t = new List<Test__c>();
Thanks
-
- OnurK
- October 27, 2011
- Like
- 1
- Continue reading or reply
Visualforce table with dynamic header
Hi all,
I want to mak a table and would like to use the days of the month as header. For example in January there would be 31 columns and February 28 coumns etc. Column headers can be 1 , 2, 3, 4 or anything else. Is there anyone can share a sample code with me?
Thank you all in advance.
- OnurK
- January 14, 2013
- Like
- 0
- Continue reading or reply
Urgent- Redirect from Child page to Parent object
Hi,
I have a Master-Detail relationship between Opportunity and Deal.
When i save a record in Deal page(Visualforce page), i want it to get redirected to the Opportunity detail page.
Its kind of urgent, please let me know how can i do this.
Thanks..
- imishra
- January 11, 2013
- Like
- 0
- Continue reading or reply
Mass Delete
I'm trying to write a class that will delete all records in a custom object with a specific status. Can't seem to get pass the syntax.
I've got this...
public with sharing class DeletePostedToHistory{
List<CustomObj__c> CustomObj = [
select status__c
from CustomObj__c
where status__c = 'Posted to History'];
delete CustomObj;
}
But I get the error "expecting right curly bracket, found 'delete'
What am I missing here?
Thanks,
- JeffStevens
- October 28, 2011
- Like
- 0
- Continue reading or reply
Email template is not fetching the correct field value - Assignment Rules
Hi,
I have a scenario where I have to send an email on case creation. In the email template I am referring the field case owner. Also, in After Insert I am changing the owner of the case by running the assignment rules through code. But the issue is the emails I received show the old owner of the record and not the changed one.
Kindly reply asap.
- SalesFORCE_enFORCEr
- October 28, 2011
- Like
- 0
- Continue reading or reply
Array vs List
Hi All,
Can anyone please explain me the difference between List and Array.
Test__c[] t = new Test__c[0];
vs
List<Test__c> t = new List<Test__c>();
Thanks
- OnurK
- October 27, 2011
- Like
- 1
- Continue reading or reply
SObject row does not allow errors
Can you helpm for adding the error message here? I am getting SObject row does not allow errors message
trigger beforeCase on Case (before insert, before update) {/* // List <Case> cs = Trigger.new; // TaxNumberDuplicate.checkDuplicates (cs); Set<String> taxNumber =new Set<String>(); for (Case c : trigger.new) { taxNumber.add(c.Tax_Number__c); } List<Case> duplicatecaseList = new List<Case>(); for(Case c : [SELECT id, Tax_Number__c, permit_duplicate__c FROM Case WHERE Tax_Number__c IN: TaxNumber]) duplicatecaseList.add(c); for(Case cs : duplicatecaseList){ if(trigger.isInsert){ if(duplicatecaseList.size()> 0 && cs.permit_duplicate__c == FALSE && cs.Tax_Number__c != Null){ cs.Tax_Number__c.addError('ERROR!!!!!'); } } else if(trigger.isUpdate){ if(duplicatecaseList.size()> 0 && cs.permit_duplicate__c == FALSE && cs.Tax_Number__c != Null && System.trigger.oldMap.get(cs.id).Tax_Number__c != System.trigger.newMap.get(cs.id).Tax_Number__c ){ cs.Tax_Number__c.addError('ERROR!!!!!'); } } } */ }
- OnurK
- September 28, 2011
- Like
- 0
- Continue reading or reply
oldMap and newMap in Class
Hi All;
I have a class runs after trigger. I need my class not run after an update when the certain field not updated. (I need my trigger runs after tax number changes) In trigger body it is possible to accomplish this with;
System.trigger.oldMap.get(c.id).Tax_Number__c != System.trigger.newMap.get(c.id).Tax_Number__c )
I can not add this code in a class. There must be some other way we can compare old value vs new value in a class. Can anyone help me with the issue I have?
Thank you very much for your help.
- OnurK
- September 20, 2011
- Like
- 0
- Continue reading or reply
100% coverage in Sandbox none in Production
I have a class runs before insert cases. It checks the duplicated tax number. It works perfect in Sandbox but there is covearge problem in Production. Can anyone help with the issue?
Thanks
public class TaxNumberDuplicate{ public static void checkDuplicates (List<Case> caseList) { List<Case> duplicatecaseList = new List<Case>(); for (Case c : caseList) { duplicatecaseList = [SELECT id FROM Case WHERE Tax_Number__c =: c.Tax_Number__c]; } if(trigger.isInsert){ if(duplicatecaseList.size()> 0 && c.Permit_Duplicate__c== FALSE && c.Tax_Number__c != Null){ c.Tax_Number__c.addError('ERROR'); } } else if(trigger.isUpdate){ duplicatecaseList = [SELECT id FROM Case WHERE Tax_Number__c =: c.Tax_Number__c]; if(duplicatecaseList.size()> 0 && c.Permit_Duplicate__c == FALSE && c.Tax_Number__c != Null){ c.Tax_Number__c.addError('ERROR'); } } } }
- OnurK
- September 06, 2011
- Like
- 0
- Continue reading or reply
extract or export via Apex Data Loader command line is over 300 times slower than expected
When I perform a certain export operation using the Apex Data Loader GUI, the operation takes about 10 seconds to complete.
When I attempt the exact same operation using the Apex Data Loader through the command line, the operation takes almost 1 hour to complete.
Has anyone else encountered this massive discrepancy? And does anyone have any ideas on how to speed up the command line operation?
- Marty Y. Chang
- April 18, 2011
- Like
- 0
- Continue reading or reply
Updating Lookup Field
Hi everyone,
I have US university names stored in Accounts. I also collect information from web-to-lead, "university name" is a drop down comes as a text field from web site to lead. Landing field in Leads is called 'University Name". (University_name__c) I would like to update lookup field "University" in Leads (University__c) (which is a lookup and connected to Accounts) by using the text value from University_name__c. Here is the code I am working with. I appreciate a lot if anyone can help.
trigger LeadAccount on Lead (before insert, before update) {
List<String> LeadUni = new List<String>();
//University_name__c is a text field in Leads
for(Lead ld : trigger.new)
if(ld.University_name__c != null)
LeadUni.add(ld.University_name__c);
//AccountMap stores Account id from University_name__c field because Account.Name = Lead.University_name__c.
Map<String, Account> AccountMap = new Map<String, Account>(
[SELECT id from Account where name IN: LeadUni]);
for(Lead ld : Trigger.new)
ld.University__c = AccountMap.get(ld.University_name__c).id;
}
Thanks
- OnurK
- August 29, 2010
- Like
- 0
- Continue reading or reply
Creating related records in visualforce page
Hi All,
I have two objects Event__C and Registrant__C .on Registrant object we hav a lookup field event link pointing to event object .
Now i have created a VF page on event object which i am displaying on site.
in this page the first part shows details of events using output field and the second part shows registrant object fields so that a site user can register for the event .But i am not able to do it properly .Please help me .
Getting error "
Error: Invalid field Registrant__r for SObject Event__c |
"
Heres the code
<apex:page standardController="event__c" sidebar="false" showHeader="false" extensions="Registerbutton">
<table width="90%" align="center">
<tr>
<td>
<apex:form >
<apex:pageBlock title="Welcome For Registration" >
<apex:pageBlockSection title="Event Details">
<apex:Outputfield value="{!Event__c.Name}" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Guest Information" columns="2">
<apex:inputField value="{!Event__c.Registrant__r.First_Name__c}" />
<apex:inputField value="{!Event__c.Registrant__r.Last_Name__c}" />
<apex:inputField value="{!Event__c.Registrant__r.Company__c}" />
<apex:inputField value="{!Event__c.Registrant__r.Email__c}" />
<apex:inputField value="{!Event__c.Registrant__r.Phone__c}" />
<apex:inputField value="{!Event__c.Registrant__r.Address__c}" />
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom" >
<apex:commandButton action="{!Register}" value="Register " />
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:image value="{!$Resource.elephant1}" width="100%" height="50%" />
</apex:form>
</td>
</tr>
</table>
</apex:page>
- gautam
- May 17, 2010
- Like
- 0
- Continue reading or reply
Creating Grid Structure in Visual force
Hi,
I need to create one Grid Structure in Visualforce page. The row Headings and Column headings will get populatetd from 2 lists. Can anybody please tell me how to achieve this..
I will give one example. Say, I have a list of Strings containings Account Names and another List containing Contact Names. Now, I need to keep Account Names in rows and Contact names in columns. At least I am trying to acheve this before proceeding further.
Please help..
Thanks in advance,
Suvra
- Suvra
- June 29, 2009
- Like
- 0
- Continue reading or reply