-
ChatterFeed
-
4Best Answers
-
0Likes Received
-
0Likes Given
-
36Questions
-
74Replies
Force.com project deployment updated profiles!
-
- mallikam
- March 11, 2010
- Like
- 0
- Continue reading or reply
Deployment updated everything!!
I created some custom fields and validation rules under under Opportunity standard object. Then I added these to my project through add/remove componenets. Then I deployed the Opportunity object onto the production.
Is this the right way to deploy my new stuff onto production? For classes or triggers, it would show me what exactly is being updated on production. I dont think it showed me that for Opportunity object.
The problem now is that whole opportunity object got updated on production. Did I do something wrong? And there is no way to go back, thats the worst part!! Any help is greately appreciated.
-
- mallikam
- March 08, 2010
- Like
- 0
- Continue reading or reply
Restricting triggers to page layouts??
-
- mallikam
- January 29, 2010
- Like
- 0
- Continue reading or reply
What could be wrong with this triggers?
I have the following trigger which checks off the Executive for every new Case based on the Executive value in Contacts.
trigger Executive on Case (before insert, before update) { Map<Id, Case[]> contactCaseMap = new Map<Id, Case[]>(); For (Case ncase:Trigger.new) { Id cid = ncase.contactId; If (cid != NULL) { if(contactCaseMap.get(cid) == null) contactCaseMap.put(cid, new Case[]{}); contactCaseMap.get(cid).add(ncase); } } For(Contact c:[select Executive__c from Contact where Id IN :contactCaseMap.keySet()]) { for(Case ncase:contactCaseMap.get(c.id)) { ncase.Executive__c = c.Executive__c; } } }
It works fine except that every now and then I get following exception in email from Production.
Apex script unhandled trigger exception by user/organization: xxxxxxxxxxxxx/xxxxxxxxxxxx
Executive: execution of BeforeInsert
caused by: System.Exception: Too many SOQL queries: 21
Trigger.Executive: line 12, column 17
But I dont see what wrong with my code. Nevertheless, I changed the code to following avoiding many for loops:
trigger Executive on Case (before insert, before update) { Map<Id, Case[]> contactCaseMap = new Map<Id, Case[]>(); Id cid; Contact d = new Contact(); for (Case ncase:Trigger.new) { cid = ncase.contactId; if (cid != NULL) { if(contactCaseMap.get(cid) == null) contactCaseMap.put(cid, new Case[]{}); contactCaseMap.get(cid).add(ncase); } } if (cid != NULL) { list<Contact> c = [select Executive__c from Contact where Id IN :contactCaseMap.keySet() limit 1]; if (c.size()!=0) {d=c[0];} Trigger.new[0].Executive__c = d.Executive__c; } }
But I get the same exact exception still every other day. I am not able to understand whats going wrong. Any help?
-
- mallikam
- January 06, 2010
- Like
- 0
- Continue reading or reply
custom buttons disappear on inline editing?
I have a custom button for one of my standard objects and it disappears when I inline edit..can I make them appear somehow?
thanks!
-
- mallikam
- December 15, 2009
- Like
- 0
- Continue reading or reply
URLFOR redirecting to the same page
I have written the following code for VF page and I have overrided opportunity new button with this page:
<apex:page standardController="Opportunity"> <script> window.top.location.replace("{!URLFOR($Action.Opportunity.New, opportunity.id, [saveURL='/apex/oppRedirect', retURL='/'+opportunity.id, cancelURL='/'+opportunity.id], true)}"); </script> </apex:page>
The problem is that when I click new opportunity, I am directed to another page that has a pick list to select tha opportunity type. When I selct the opportunity type and hit continue, I am getting redirected to the same page! But when I hit continue again, I am getting redirected to the next page correctly..I am unable to fix the problem of getting redirected to the same page when I click continue first time though..any help is appreciated!
-
- mallikam
- December 09, 2009
- Like
- 0
- Continue reading or reply
execution of BeforeInsert caused by: System.Exception: Too many SOQL queries: 21
Hi,
I have a trigger with the following code, everything seems to be working fine until I got the above exception through email this morning. The code looks simple and correct to me an so I am having hard time figuring out why the query could have run into governor limits exception..
trigger Executive on Case (before insert, before update) { Map<Id, Case[]> contactCaseMap = new Map<Id, Case[]>(); For (Case ncase:Trigger.new) { Id cid = ncase.contactId; If (cid != NULL) { if(contactCaseMap.get(cid) == null) contactCaseMap.put(cid, new Case[]{}); contactCaseMap.get(cid).add(ncase); } } For(Contact c:[select Executive__c from Contact where Id IN :contactCaseMap.keySet()]) { // code is // running into exception at this // query
Thanks!
-
- mallikam
- November 13, 2009
- Like
- 0
- Continue reading or reply
redirecting to a URL through triggers
How can we redirect a trigger to a standard salesforce URL? Like when the user updates a cutom field in Opportunity, I want him to go to the new Partner reated list page directly when he hits save. Usually you can only see the new partner page only when you click New in Partner subsection from the opportunity details page. But I want to mandate the partner related list page when user selects YES for a custom field in Opportunity page.
-
- mallikam
- September 23, 2009
- Like
- 0
- Continue reading or reply
Showing partner related list on custom field update
I want to show partner related list on a custom field update(if yes) in opportunity. The partner related list is usually visible only after you save a opportunity and you can only edit it after you click new Partner.
I am thinking of doing this with work flow and s-control but have no idea how I can do it. I mean I dont know how can you or where you should reference a s-control with workflow?
Basically, I want to mandate the partner related list in opportunity when the user changes a custom field(picklist) to yes in opportunity. I have number of fields and I want user to fill the respective partner related list for each field that they say yes.
thanks!!
-
- mallikam
- September 23, 2009
- Like
- 0
- Continue reading or reply
Cloning a standard object
-
- mallikam
- September 08, 2009
- Like
- 0
- Continue reading or reply
Questions about standard object
1. If a value is selected from a custom pick list, can we make some other fields in the section mandatory say for example in Accounts object? If so, should I write a workflow for achieving this?
2. Can I display an alert message when a value is selected?
3. If I want to write java script code for standard object, is that possible?
Any answers are appreciated.
-
- mallikam
- September 04, 2009
- Like
- 0
- Continue reading or reply
Record ID: cannot Specify ID in an Insert Call
I have the following function which is being called on page submit for my visual force page. I am getting the following error when the user hits submit
Record ID: cannot Specify ID in an Insert Call
And the code is below
public PageReference confirm() {case ticket = new case();
if (this.request != null) {request.Title__c = this.empTitle;request.Department__c =
this.empDept; request.Reports_to__c = this.repToEmail;
try {
insert request; } catch (system.DMLException e){ApexPages.addMessages(e);
return null;}
this.caseId1 = generateNewTicket(request.employee_name__c, request.Grant_Email_access_to__c,request.Outlook_out_of_office_message__c, request.Blackberry_user__c );
if (this.caseId1 == NULL)
return null;
}
list<Case> a = [Select c.CaseNumber from Case c where c.Id = :this.caseId1 limit 1];
if(a.size() != 0) {ticket = a[0];}
this.confNumber = ticket.CaseNumber;try{ sendEmail(this.confNumber);
sendEmail();
} catch (EmailException e){ApexPages.addMessages(e);
return null;}
PageReference p = Page.offbsubmit;
p.setRedirect(true);
return p;}
It says problem with insert but I see the new request was created! But I did not get any emails, so may be it was
choking at that part but I dont understand why. Any help please?
-
- mallikam
- August 11, 2009
- Like
- 0
- Continue reading or reply
-
- mallikam
- August 07, 2009
- Like
- 0
- Continue reading or reply
changing the from address of automated emails
-
- mallikam
- July 30, 2009
- Like
- 0
- Continue reading or reply
testing pagereferences in assertEquals
I have the following code in one of the controller extension methods:
confirm() {
PageReference p = Page.offbsubmit;
p.setRedirect(true);
return p;
}
I am testing the above code in testMethod using the following statement..
PageReference q = test.confirm();
PageReference s = Page.offbsubmit;
system.assertEquals(q, s); // getting an exception here!!
I am getting the following exception:
System.Exception: Assertion Failed: Expected: System.PageReference[/apex/offbsubmit], Actual: System.PageReference[/apex/offbsubmit]
which doesnt make anysense to me because the expected and the actual values are the same..any help?
-
- mallikam
- July 28, 2009
- Like
- 0
- Continue reading or reply
whats the difference?(question about triggers)
Following an example, I have written the following statement in my trigger after update which is activated when a child case is closed:
list<Case> a = [Select Id from Case where Id = :Trigger.New[0].ParentId and Subject = 'Delete Network ID or Reset password' limit 1];
if(a.size() != 0) { b = a[0];}
It works just fine! Then, I thought why cant I just have a single sboject instead of a list of sobjects and I changed the above to
the following:
Case a = [Select Id from Case where Id = :Trigger.New[0].ParentId and Subject = 'Delete Network ID or Reset password' limit 1];
This statement is throwing an exception when I try to close a child case if the parent objects subject is not a 'Delete Network ID or Reset password'.
System.QueryException: List has no rows for assignment to SObject
Why so? I did not understand exactly how a list is making the difference?
-
- mallikam
- July 27, 2009
- Like
- 0
- Continue reading or reply
problem with trigger
I wrote a trigger after update for child cases. If all the child cases are closed, the Inactive field of the ContactId reference of the parent case will be set to true...I am getting an exception with the following code, when I try to close the last child case. Its then trying to evaluate the innermost if condition and hitting the exception..
trigger childsClosed on Case (after update) { Case b = new Case(); if (Trigger.New[0].Status == 'Closed') { if (Trigger.New[0].ParentId != null) { list<Case> a = [Select Id from Case where Id = :Trigger.New[0].ParentId and Subject = 'Delete Network ID or Reset password' limit 1]; if(a.size() != 0) { b = a[0];} if (b.Id != null) { integer childCases = [Select count() from Case where ParentId = :b.Id]; integer closed = [Select count() from Case where ParentId = :b.id and Status = 'Closed']; if (closed == childCases) { b.Contact.Inactive__c = true; } } } } }
And I am getting the exception that says:
Apex script unhandled trigger exception by user/organization: 005700000018KNh/00D70000000JLCa
childsClosed: execution of AfterUpdate
caused by: System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Case.Contact
Trigger.childsClosed: line 12, column 6
-
- mallikam
- July 23, 2009
- Like
- 0
- Continue reading or reply
send an email when all child cases are closed
-
- mallikam
- July 22, 2009
- Like
- 0
- Continue reading or reply
cannot create a record through sites
I am unable to create a record through sites which is integrated with a visual force page. I have the read, create, edit permissions checked for the custom object on public access settings. I can create the records through the VF page that the sites refers to but I am unable to create the same through sites. Any help? Here is the controller code that is being called when I hit submit button and expect the record be created..
public PageReference confirm() {
if (this.request != null) {
try {insert request; }
catch (system.DMLException e){ApexPages.addMessages(e);
return null;
}
PageReference p = Page.submit;
p.setRedirect(true);
return p;
}
-
- mallikam
- July 22, 2009
- Like
- 0
- Continue reading or reply
question about parent and child cases
-
- mallikam
- July 17, 2009
- Like
- 0
- Continue reading or reply
Force.com project deployment updated profiles!
- mallikam
- March 11, 2010
- Like
- 0
- Continue reading or reply
Restricting triggers to page layouts??
- mallikam
- January 29, 2010
- Like
- 0
- Continue reading or reply
What could be wrong with this triggers?
I have the following trigger which checks off the Executive for every new Case based on the Executive value in Contacts.
trigger Executive on Case (before insert, before update) { Map<Id, Case[]> contactCaseMap = new Map<Id, Case[]>(); For (Case ncase:Trigger.new) { Id cid = ncase.contactId; If (cid != NULL) { if(contactCaseMap.get(cid) == null) contactCaseMap.put(cid, new Case[]{}); contactCaseMap.get(cid).add(ncase); } } For(Contact c:[select Executive__c from Contact where Id IN :contactCaseMap.keySet()]) { for(Case ncase:contactCaseMap.get(c.id)) { ncase.Executive__c = c.Executive__c; } } }
It works fine except that every now and then I get following exception in email from Production.
Apex script unhandled trigger exception by user/organization: xxxxxxxxxxxxx/xxxxxxxxxxxx
Executive: execution of BeforeInsert
caused by: System.Exception: Too many SOQL queries: 21
Trigger.Executive: line 12, column 17
But I dont see what wrong with my code. Nevertheless, I changed the code to following avoiding many for loops:
trigger Executive on Case (before insert, before update) { Map<Id, Case[]> contactCaseMap = new Map<Id, Case[]>(); Id cid; Contact d = new Contact(); for (Case ncase:Trigger.new) { cid = ncase.contactId; if (cid != NULL) { if(contactCaseMap.get(cid) == null) contactCaseMap.put(cid, new Case[]{}); contactCaseMap.get(cid).add(ncase); } } if (cid != NULL) { list<Contact> c = [select Executive__c from Contact where Id IN :contactCaseMap.keySet() limit 1]; if (c.size()!=0) {d=c[0];} Trigger.new[0].Executive__c = d.Executive__c; } }
But I get the same exact exception still every other day. I am not able to understand whats going wrong. Any help?
- mallikam
- January 06, 2010
- Like
- 0
- Continue reading or reply
execution of BeforeInsert caused by: System.Exception: Too many SOQL queries: 21
Hi,
I have a trigger with the following code, everything seems to be working fine until I got the above exception through email this morning. The code looks simple and correct to me an so I am having hard time figuring out why the query could have run into governor limits exception..
trigger Executive on Case (before insert, before update) { Map<Id, Case[]> contactCaseMap = new Map<Id, Case[]>(); For (Case ncase:Trigger.new) { Id cid = ncase.contactId; If (cid != NULL) { if(contactCaseMap.get(cid) == null) contactCaseMap.put(cid, new Case[]{}); contactCaseMap.get(cid).add(ncase); } } For(Contact c:[select Executive__c from Contact where Id IN :contactCaseMap.keySet()]) { // code is // running into exception at this // query
Thanks!
- mallikam
- November 13, 2009
- Like
- 0
- Continue reading or reply
redirecting to a URL through triggers
How can we redirect a trigger to a standard salesforce URL? Like when the user updates a cutom field in Opportunity, I want him to go to the new Partner reated list page directly when he hits save. Usually you can only see the new partner page only when you click New in Partner subsection from the opportunity details page. But I want to mandate the partner related list page when user selects YES for a custom field in Opportunity page.
- mallikam
- September 23, 2009
- Like
- 0
- Continue reading or reply
question about parent and child cases
- mallikam
- July 17, 2009
- Like
- 0
- Continue reading or reply
Overriding Save Button
I am trying to add a warning message like "Are you Sure" before Saving an Opportunity. I do not know how to over ride the save button. Could someone help me on this please?
Thanks
Venkat
- venkatSanthanam
- April 05, 2009
- Like
- 0
- Continue reading or reply
Override Opportunity Save Functionality on New Record
I am trying to figure out a way to effectively redirect the user to a VisualForce page after a new opportunity is created, while passing in the ID of the new Opportunity. The overall objective is to require the user to enter additional information about the Opportunity on a separate screen. I'd also like to avoid completely recreating the Opportunity edit page in VF so that the admins can still add/change fields and use the PageLayout Editor.
My thought was that I could use the standard Opportunity Controller on a VF page and then use <apex:detail>, however it doesn't seem like it's possible to call an Apex page for a new record unless you're manually building the form. For example:
- https://na6.salesforce.com/006/e?retURL=/apex/OppPart2/id=newOppID - This would redirect the user to a specific page after the save has completed, but there's no way to know the newOppID ahead of time.
- https://na6.salesforce.com/apex/NewOpportunity/e - Calling a VF page with the standard /e at the end fails with an error
- https://na6.salesforce.com/apex/NewOpportunity?ID= - Calling a VF page with a blank ID parameters displays a blank screen.
Does anyone know of a way to either:
- Override the [Save] button functionality on a New Opportunity without recreating the entire edit form in VF?
- Create a VF page that can determine the ID of the Opportunity just created
- Any other way to have display a specific VF page after creating a new opportunity?
Thanks for your help.
Mike
- Force2b_Mike
- February 24, 2009
- Like
- 0
- Continue reading or reply
redirect to Visualforce page on record save
Does anyone have any ideas on how to accomplish this?
Thanks in advance...
- Cthulhu4242
- November 21, 2008
- Like
- 0
- Continue reading or reply