-
ChatterFeed
-
2Best Answers
-
1Likes Received
-
0Likes Given
-
28Questions
-
23Replies
Setting SSO with Sites
I have created some pages using Sites and have linked it with the Customer Portal Login. I am trying to set up SSO for my customers to login into sites. I am trying to use OpenSSO. Can anyone please share steps on setting this up.
We tried few sample settings and it returns to the default Customer Portal page and not to the sites.
Thanks
KD
-
- kdmr
- December 07, 2012
- Like
- 0
- Continue reading or reply
Question related to AppExchange security review process
Hi,
When building an App in Salesforce.com that will integrate with external systems, can we save the salesforce user credentials outside so that the system may connect with Salesforce.com using the partner WSDL.
Else is there any other method through which we can have a 2 way integration with an external system.
Thanks
KD
-
- kdmr
- July 05, 2012
- Like
- 0
- Continue reading or reply
Change Lookup fields to Picklist
Hi,
I have 2 custom objects Obj1 and Obj2, Obj2 has a lookup reference to Obj1. I am trying to make the lookup reference field show up as a Picklist so that users may select the value from the drop down option rather than the pop-up window for the lookup.
If the above request can be achieved using Visualforce pages, any pointers on doing the same would be helpful.
Thanks
KD
-
- kdmr
- May 14, 2011
- Like
- 0
- Continue reading or reply
getting junk when exporting as xml
Hi,
I am trying to export information from Salesforce as xml that can be used by another application locally. I wrote a controller class that will help me in parsing the xml tags and inserting the values. I then created a visualforce page that will provide the option of showing the xml string.
The controller code is
/* This is the controller class to export the required quote infomation as xml for further use in a dot net based program. */public class quotesController { /* Declaring the objects, variables and other items that will be used through out this class. */ Quote__c quotes; Quote_Line__c quoteLines; Id quoteId; List<Quote_Line__c> quoteLinesList = new List<Quote_Line__c>(); /* To make the class as the extension for the standard controller for the visualforce page calculateTax. We also get the Quote id here for which we are going to calculate the tax for. */ public quotesController(ApexPages.StandardController stdController) { this.quotes = (Quote__c)stdController.getRecord(); quotes = [select Id, Name, Quote_Name__c, Total__c from Quote__c where Id = :ApexPages.currentPage().getParameters().get('id')]; quoteId = ApexPages.currentPage().getParameters().get('id'); } /* This function is to query for the quote line items for the particular quote. Save the result of the query to the list and make the list as the return value of this function. */ public List<Quote_Line__c> getquoteLines() { quoteLinesList = [select Id, Name, Line_Item__c, Rate__c from Quote_Line__c where Quote_Number__r.Id = :quoteId]; return quoteLinesList; } /* This function is to create the xml tags and the populate them with the related values. */ public string getxmlOutput() { Integer i; String total = quotes.Total__c.format(); String rate; XmlStreamWriter xmlValues = new XmlStreamWriter(); xmlValues.writeStartDocument(null,'1.0'); xmlValues.writeProcessingInstruction('target','data'); xmlValues.writeStartElement(null,'CalculateTax',null); xmlValues.writeStartElement(null,'Quotes',null); xmlValues.writeStartElement(null,'QuoteId',null); xmlValues.writeCharacters(quotes.Id); xmlValues.writeEndElement(); xmlValues.writeStartElement(null,'QuoteNumber',null); xmlValues.writeCharacters(quotes.Name); xmlValues.writeEndElement(); xmlValues.writeStartElement(null,'QuoteName',null); xmlValues.writeCharacters(quotes.Quote_Name__c); xmlValues.writeEndElement(); xmlValues.writeStartElement(null,'QuoteTotal',null); xmlValues.writeCharacters(total); xmlValues.writeEndElement(); xmlValues.writeEndElement(); for(i = 0; i<quoteLinesList.size(); i++) { rate = quoteLinesList[i].Rate__c.format(); xmlValues.writeStartElement(null,'QuoteLines',null); xmlValues.writeStartElement(null,'QuoteLineId',null); xmlValues.writeCharacters(quoteLinesList[i].Id); xmlValues.writeEndElement(); xmlValues.writeStartElement(null,'QuoteLineNumber',null); xmlValues.writeCharacters(quoteLinesList[i].Name); xmlValues.writeEndElement(); xmlValues.writeStartElement(null,'QuoteLineName',null); xmlValues.writeCharacters(quoteLinesList[i].Line_Item__c); xmlValues.writeEndElement(); xmlValues.writeStartElement(null,'QuoteLineRate',null); xmlValues.writeCharacters(rate); xmlValues.writeEndElement(); xmlValues.writeEndElement(); } xmlValues.writeEndElement(); xmlValues.writeEndDocument(); String xmlStringOutput = xmlValues.getXmlString(); xmlValues.close(); return xmlStringOutput; }}
The visualforce code is
<!-- The visual force page that will help to export the values from the controller extension class quotesController.--><apex:page standardController="Quote__c" extensions="quotesController" contentType="text/xml" cache="true"> <!-- contentType="text/xml-external-parsed-entity" cache="true"> --> <apex:pageBlock > <apex:repeat value="{!quoteLines}" var="qln"></apex:repeat> <apex:outputText value="{!xmlOutput}"> </apex:outputText> </apex:pageBlock></apex:page>
The first problem that i faced was that i was not able to save the output as a file. For this i used the content type text/xml-external-parsed-entity. Using this content type i was able to save it as a file.
The other problem i am not able to resolve is the fact that the output is getting wrapped inside html code. Like
f(!window.sfdcPage){window.sfdcPage = new ApexPage();} UserContext.initialize({'locale':'en_US','timeFormat':'h:mm a','today':'2\/6\/2010 12:40 AM','userPreferences':[{'value':false,'index':112,'name':'HideInlineEditSplash'} ,{'value':false,'index':114,'name':'OverrideTaskSendNotification'} ,{'value':false,'index':115,'name':'DefaultTaskSendNotification'} ,{'value':false,'index':119,'name':'HideUserLayoutStdFieldInfo'} ,{'value':false,'index':116,'name':'HideRPPWarning'} ,{'value':false,'index':87,'name':'HideInlineSchedulingSplash'}
Please help in getting only the xml tags.
Thanks
Krishnadas M R
-
- kdmr
- February 06, 2010
- Like
- 0
- Continue reading or reply
How to create and save XML file
Hi,
I have one custom button. If i click this button, i need to get the data and create the XMLfile.
Can i create the XML file and write data into the XML?
Note: Need to get the data from salesforce to local.
Thanks for any help,
-
- kdmr
- January 27, 2010
- Like
- 0
- Continue reading or reply
NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile.
Hi,
am trying to send the mass email to contacts.I am getting the error as below.Am doing this in a DE org.
System.EmailException:
SendEmail failed. First exception on row 0; first error:
NO_MASS_MAIL_PERMISSION, Single email is not enabled for your
organization or profile. Single email must be enabled for you to use
this feature.
My coding as below
private final List<Id> contactids;
public List<Contact> con;
public testemail(ApexPages.StandardController controller)
{
con = [select Id from Contact limit 5];
contactids=new List<Id>();
for(Integer i=0;i<con.size();i++)
{
contactids.add(con[i].Id);
}
}
public void SendEmail()
{
Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
mail.setTargetObjectIds(contactids);
mail.setTemplateId('00X90000000ZQgA');
Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });
}
Can anybody tell me how to enable single email/mass email?
Thanks for any help
-
- kdmr
- January 18, 2010
- Like
- 0
- Continue reading or reply
Use Visual force template in workflow(Email Alert)
Hi,
I would like to send a mail to a contact when case is created.The Email contains list of cases related to account.
So i created workflow with condition(case status = new) and type is Email Alert.
It is working fine when I send it from a Send Email button on a Contact detail. When trying from work flow,its sends the mail but doesn't populate any values.
Code as below
<messaging:emailTemplate recipientType="Contact" relatedToType="Account"
subject="Case report for Account: {!relatedTo.name}">
<messaging:htmlEmailBody >
<html>
<body>
<p>Dear {!recipient.name},</p>
<p>Below is a list of cases related to the account: {!relatedTo.name}.</p>
<table border="0" >
<tr >
<th>Action</th><th>Case Number</th><th>Subject</th><th>Creator Email</th><th>Status</th>
</tr>
<apex:repeat var="cx" value="{!relatedTo.Cases}">
<tr>
<td><a href="https://na1.salesforce.com/{!cx.id}">View</a> |
<a href="https://na1.salesforce.com/{!cx.id}/e">Edit</a></td>
<td>{!cx.CaseNumber}</td>
<td>{!cx.Subject}</td>
<td>{!cx.Contact.email}</td>
<td>{!cx.Status}</td>
</tr>
</apex:repeat>
</table>
<p/>
<center>
<apex:outputLink value="http://www.salesforce.com">
For more detailed information login to Salesforce.com
</apex:outputLink>
</center>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
Thanks for any help
-
- kdmr
- January 12, 2010
- Like
- 0
- Continue reading or reply
Error Invalid Integer while using adddays method
Hi, I have been trying to do a calculation on the date type field when I keep encountering this error
double d = integer.valueof(mfrwdays);
integer i = d.intValue();
enddate = objassetconfig.MfrWarrantyStart__c.adddays(i);
where mfrdays is the value for a inputtext in the vf page. I have also tried to accept integer value directly from the string and still result with the same error. Require some help on this.
Thanks
KD
-
- kdmr
- June 23, 2009
- Like
- 0
- Continue reading or reply
Visual force page error
We have several Visualforce pages being used in our org. These were working okay until evening of 20th. But now few of them are showing the following error
Tag library supports namespace: http://salesforce.com/standard/components/apex, but no tag was defined for name: form
I checked through the forums for a solution and found that salesforce is working on fixing this. Would like to know if this is fixed or to whom should we report this to.
Thanks
KD
-
- kdmr
- June 22, 2009
- Like
- 0
- Continue reading or reply
unable to add custom button to list view
Hi,
I have created a custom list button and want to add this to the list view as well as related lists. I was able to add this custom button to the related list, but not to the standard list page. I am going to the object settings and am adding it to the list view layout, but the button is not showing. How do I get this displayed in the List view?
Thanks
KD
-
- kdmr
- June 20, 2009
- Like
- 0
- Continue reading or reply
check if value is numeric
Hi,
I am using inputtext tag to get some values in a custom visualforce page. I would like to know if we can restrict users to enter only numeric value in the input text. How do we do it? Is there any way to check if the value entered is a numeric value or not.
Thanks
KD
-
- kdmr
- June 19, 2009
- Like
- 0
- Continue reading or reply
Nesting a datatable
Hi,
I am trying to create a tree structure on a visualforce page. Is it possible to nest one datatable into another datatable. Is there and expample for such a thing.
Thanks
KD
-
- kdmr
- June 17, 2009
- Like
- 0
- Continue reading or reply
Problem for the new page with picklist for Recordtypes
Hi,
I have a custom object with 5 different record types. I have visual force pages for each of the record type and a home page of sorts that gives the picklist for the record types just like the standard salesforce page. I did a override for the new button with my page, but what happens is that the standard salesforce page with the record types comesfirst and then it takes me to my page with the similar list. How do i take out the standard page?
Thanks
KD
-
- kdmr
- June 16, 2009
- Like
- 0
- Continue reading or reply
How to get Id from the Url
Hi,
I am using a visualforce page to override 'New' for an object called Obj1. This object is also part of a related list in another custom object Obj2. I would like to get the Id of the Obj2 record from where New is clicked in the controller class for the visualforce page. I am not sure how to get this done. Please help.
Thanks
KD
-
- kdmr
- June 15, 2009
- Like
- 0
- Continue reading or reply
List index out of bounds: 1
Hi, I am trying to sum up the values of a number field in an object for a particular function, when attempting to do that I encounter an error message in the for loop. The section of code is as below
Object1__c[] obj1 = [select Id, Name, Qty__c from Object1__c where lookup1id__c = :param1 and lookup2id = :param2]; for(Integer i = 0; i <= obj1.size(); i++) {
totalqty = totalqty + obj1[i].Qty__c;
}
here param1 and param2 are values that are passed from the UI to the controller. This error appears inside the forloop for the condition. I am not sure why and how to handle this.
Thanks
KD
-
- kdmr
- June 15, 2009
- Like
- 0
- Continue reading or reply
How to create error messages for visualforce page
Hi,
I am using a visualforce page and would like to add some error messages into it for example if some field is empty etc...... I do not want to set a validation rule, but would like to work on the save function in the controller to display the error message. Would be of great help if someone could point me out the direction to do that.
I have one more question relating to displaying an output in visualforce. I have a lookup field, it has quantity field too, i would like to populate the quantity from the master object, if i change the lookup the value for quantity should also change respectively, I tried formulas but they effect after save, I would like to have immediate change.
Thanks
KD
-
- kdmr
- June 08, 2009
- Like
- 1
- Continue reading or reply
How to pass value to a query
Hi All, I have a question, I am trying to create a query to be passed to the datatable based on a value from VisualForce UI, though the query compiles it takes the value as null. for eg. the query line is similar to
object2list = [select id, name, field1__c, field2__c from Object2 where object1__c =: paramval];
1. Object1__c is a related to Object2.
2.paramval is the value passed to the controller from the UI using the apex:param tag.
3. query produces table taking the paramval to be null
4. If I substitue it with the Id the query returns proper data table.
5. If I use the paramval else where and it takes the value properly and am able to save it too.
I am trying to do this so that I can have dependent lookup, the value of paramval will be the id for the value choosen for Object1__c.
Thanks
KD
-
- kdmr
- June 06, 2009
- Like
- 0
- Continue reading or reply
adding value to the record type
I am using Visualforce and APEX to save records for a Custom object Obj__c. I would like to add the recordtype in the save. Could someone tell me how to do so. Currently I am trying
Obj__c o = new Obj__c(f1__c = 'xxxx', f2__c = 'xxxx', RecordType.Name = 'xxxx');
Insert o;
I get some errorrs "Error: Compile Error: Invalid field initializer: RecordType.Name".
Please help me, how can I insert the recordtype name.
Thanks
KD
-
- kdmr
- June 04, 2009
- Like
- 0
- Continue reading or reply
List not getting updated
Hi all,
I am trying to create a dependent lookup using apex controllers and vf pages. I am using inputtext and apex param to pass the value of one of the lookupfields to the controller and then using that to query other 2 lists. The problem I face is that the value passed to the controller keeps changing to null and does not query the proper list.
I inserted the debug logs and found out the when I first call the page the queries are all run returing the value for the controlling lookup as null, when i select the value for the controlling lookup field, i can find in the debug logs that the query is executed and the appropriate lists are taken, but before returning the list, the controlling field value returns to null and thus the dependent list is not populating properly.
need some help on this as I am not able to proceed further.
Thanks in advance
KD
-
- kdmr
- June 03, 2009
- Like
- 0
- Continue reading or reply
bind input text value to controller
I am using inputtext to get a value and then passing it to the controller, where i am using it to filter some lookup values. Though both the controller and VF page complie properly, i do not see the result appropriately.
Codes related to it
public String getassetval() { return this.assetval; } public void setassetval(String el) { this.assetval = el; } plist = [select Id from Product2 where Id in (Select Product__c from Account_Asset__c where name = :assetval)];
Would like to know if this is enough for it to caputre the text in the Inputtext and pass it the controller to use it in the query. If yes, how do i findout if the variable has the value or not. If not what is the correct way to proceed.
Thanks
KD
-
- kdmr
- May 27, 2009
- Like
- 0
- Continue reading or reply
How to create error messages for visualforce page
Hi,
I am using a visualforce page and would like to add some error messages into it for example if some field is empty etc...... I do not want to set a validation rule, but would like to work on the save function in the controller to display the error message. Would be of great help if someone could point me out the direction to do that.
I have one more question relating to displaying an output in visualforce. I have a lookup field, it has quantity field too, i would like to populate the quantity from the master object, if i change the lookup the value for quantity should also change respectively, I tried formulas but they effect after save, I would like to have immediate change.
Thanks
KD
-
- kdmr
- June 08, 2009
- Like
- 1
- Continue reading or reply
Customer Portal and mobile app development - Immediate opportunity
Opportunity to customize a customer portal for a company focused on helping non-profit organizations increase productivity. The portal would need to be well designed visually to integrate with the company's website. It would be a simple design, focused on limited tabs and a knowledge base. Short turn around time. Added benefit if you have knowledge of building custom mobile apps. The app would require API with other databases within non-profit industry (i.e., etapestry). I look forward to hearnig form you!
- DoGooder
- July 11, 2012
- Like
- 0
- Continue reading or reply
Need help on Web-to-Case
Hi,
I would like to create Web-to-Case in my Salesforce.com instance, from the web page hosted under my company's website. Is it possible to add an attachment too?
Any help would be greatly appreciated.
Thanks.
- Pal2011
- July 02, 2012
- Like
- 0
- Continue reading or reply
Customer portal look and feel
Hi,
I am developing a customer portal for my company. I am able to do limited changes to the look and feel of the customer portal. But the videos posted by salesforce has adavanced look and feel of the customer portal. Could someone help me on how to make cusomer portal similar to my comapny wesite.
Here is the salesforce demo from youtube.
http://www.youtube.com/watch?v=4QAc9nOVxrQ
Is there way I can use Salesforce Sites to display customer portal data with limited coding.
Thanks,
Rag
- mascloud
- December 28, 2011
- Like
- 0
- Continue reading or reply
Use Visual force template in workflow(Email Alert)
Hi,
I would like to send a mail to a contact when case is created.The Email contains list of cases related to account.
So i created workflow with condition(case status = new) and type is Email Alert.
It is working fine when I send it from a Send Email button on a Contact detail. When trying from work flow,its sends the mail but doesn't populate any values.
Code as below
<messaging:emailTemplate recipientType="Contact" relatedToType="Account"
subject="Case report for Account: {!relatedTo.name}">
<messaging:htmlEmailBody >
<html>
<body>
<p>Dear {!recipient.name},</p>
<p>Below is a list of cases related to the account: {!relatedTo.name}.</p>
<table border="0" >
<tr >
<th>Action</th><th>Case Number</th><th>Subject</th><th>Creator Email</th><th>Status</th>
</tr>
<apex:repeat var="cx" value="{!relatedTo.Cases}">
<tr>
<td><a href="https://na1.salesforce.com/{!cx.id}">View</a> |
<a href="https://na1.salesforce.com/{!cx.id}/e">Edit</a></td>
<td>{!cx.CaseNumber}</td>
<td>{!cx.Subject}</td>
<td>{!cx.Contact.email}</td>
<td>{!cx.Status}</td>
</tr>
</apex:repeat>
</table>
<p/>
<center>
<apex:outputLink value="http://www.salesforce.com">
For more detailed information login to Salesforce.com
</apex:outputLink>
</center>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
Thanks for any help
- kdmr
- January 12, 2010
- Like
- 0
- Continue reading or reply
Error Invalid Integer while using adddays method
Hi, I have been trying to do a calculation on the date type field when I keep encountering this error
double d = integer.valueof(mfrwdays);
integer i = d.intValue();
enddate = objassetconfig.MfrWarrantyStart__c.adddays(i);
where mfrdays is the value for a inputtext in the vf page. I have also tried to accept integer value directly from the string and still result with the same error. Require some help on this.
Thanks
KD
- kdmr
- June 23, 2009
- Like
- 0
- Continue reading or reply
Visual force page error
We have several Visualforce pages being used in our org. These were working okay until evening of 20th. But now few of them are showing the following error
Tag library supports namespace: http://salesforce.com/standard/components/apex, but no tag was defined for name: form
I checked through the forums for a solution and found that salesforce is working on fixing this. Would like to know if this is fixed or to whom should we report this to.
Thanks
KD
- kdmr
- June 22, 2009
- Like
- 0
- Continue reading or reply
unable to add custom button to list view
Hi,
I have created a custom list button and want to add this to the list view as well as related lists. I was able to add this custom button to the related list, but not to the standard list page. I am going to the object settings and am adding it to the list view layout, but the button is not showing. How do I get this displayed in the List view?
Thanks
KD
- kdmr
- June 20, 2009
- Like
- 0
- Continue reading or reply
check if value is numeric
Hi,
I am using inputtext tag to get some values in a custom visualforce page. I would like to know if we can restrict users to enter only numeric value in the input text. How do we do it? Is there any way to check if the value entered is a numeric value or not.
Thanks
KD
- kdmr
- June 19, 2009
- Like
- 0
- Continue reading or reply
How to get Id from the Url
Hi,
I am using a visualforce page to override 'New' for an object called Obj1. This object is also part of a related list in another custom object Obj2. I would like to get the Id of the Obj2 record from where New is clicked in the controller class for the visualforce page. I am not sure how to get this done. Please help.
Thanks
KD
- kdmr
- June 15, 2009
- Like
- 0
- Continue reading or reply
List index out of bounds: 1
Hi, I am trying to sum up the values of a number field in an object for a particular function, when attempting to do that I encounter an error message in the for loop. The section of code is as below
Object1__c[] obj1 = [select Id, Name, Qty__c from Object1__c where lookup1id__c = :param1 and lookup2id = :param2]; for(Integer i = 0; i <= obj1.size(); i++) {
totalqty = totalqty + obj1[i].Qty__c;
}
here param1 and param2 are values that are passed from the UI to the controller. This error appears inside the forloop for the condition. I am not sure why and how to handle this.
Thanks
KD
- kdmr
- June 15, 2009
- Like
- 0
- Continue reading or reply
How to create error messages for visualforce page
Hi,
I am using a visualforce page and would like to add some error messages into it for example if some field is empty etc...... I do not want to set a validation rule, but would like to work on the save function in the controller to display the error message. Would be of great help if someone could point me out the direction to do that.
I have one more question relating to displaying an output in visualforce. I have a lookup field, it has quantity field too, i would like to populate the quantity from the master object, if i change the lookup the value for quantity should also change respectively, I tried formulas but they effect after save, I would like to have immediate change.
Thanks
KD
- kdmr
- June 08, 2009
- Like
- 1
- Continue reading or reply
How to pass value to a query
Hi All, I have a question, I am trying to create a query to be passed to the datatable based on a value from VisualForce UI, though the query compiles it takes the value as null. for eg. the query line is similar to
object2list = [select id, name, field1__c, field2__c from Object2 where object1__c =: paramval];
1. Object1__c is a related to Object2.
2.paramval is the value passed to the controller from the UI using the apex:param tag.
3. query produces table taking the paramval to be null
4. If I substitue it with the Id the query returns proper data table.
5. If I use the paramval else where and it takes the value properly and am able to save it too.
I am trying to do this so that I can have dependent lookup, the value of paramval will be the id for the value choosen for Object1__c.
Thanks
KD
- kdmr
- June 06, 2009
- Like
- 0
- Continue reading or reply
How to create a dependent lookup
Hi
I am fairly new to Force.com development and have hit an issue trying to build some relationships on a custom object.
I have an 'Assessment' custom object with a custom lookup field to a 'Claim' custom object. I want to build a further custom lookup field on Assessment: 'Claim Contact' that looks up from another custom object, but this object is the detail in a master-detail relationship with the Claim object.
I want to know how to constrain the 'Claim Contact' lookup so that it only shows values that are related to the Claim that has already been looked up on to the Assessment.
i.e. if the Assessment is linked to Claim A, which has child Contacts Jack and Jill, then these should be the only contacts I am able to pick using the 'Claim Contact' lookup on the Assessment. If the assessment is not linked to any Claim then I need the lookup to return no results.
Is there a configuration solution to this or if not does anyone know what the best approach is to do this?
Many thanks in advance!
- Demint
- April 15, 2009
- Like
- 0
- Continue reading or reply
apex:Param assignTo not working in a dataTable (bug)
Here is the code to reproduce. I tried to make it as short as possible but sorry it is still a little long, see steps below code:
Page:
<apex:page controller="paramBug" > <apex:form > <apex:pageBlock > <apex:outputPanel id="table"> {!showTable} <apex:pageBlockTable value="{!opps}" var="o" rendered="{!showTable}"> <apex:column headerValue="Status"> <apex:outputPanel id="oppStatus"> <apex:outputText value="Y" rendered="{!IF(o.status = 'modified', true, false)}"/> </apex:outputPanel> </apex:column> <apex:column value="{!o.opp.Name}"/> <apex:column > <apex:facet name="header"> <apex:commandLink value="Stage" rerender="table,debug" action="{!sortTable}" status="sorting"> <apex:param value="StageName" assignTo="{!sortColumn}" /> </apex:commandLink> </apex:facet> <apex:inputField value="{!o.opp.StageName}"> <apex:actionSupport event="onchange" action="{!change}" rerender="oppStatus,buttons"> <apex:param name="oid" value="{!o.opp.id}" assignTo="{!changedOpp}" /> </apex:actionSupport> </apex:inputField> </apex:column> </apex:pageBlockTable> </apex:outputPanel> </apex:pageBlock> </apex:form> </apex:page>
Controller:
public class paramBug {
List<oppWrapper> opps = new List<oppWrapper>();
List<SelectOption> stages;
public ID changedOpp {get; set;}
public string sortColumn {get; set;}
Map<String,String> sortOrder = new Map<String,String>();
//Constructor
public paramBug(){
for(Opportunity opp : [select Id, Name, StageName from Opportunity limit 10]){
opps.add(new oppWrapper(opp));
}
}
public List<oppWrapper> getOpps(){
return opps;
}
public void change(){
for(oppWrapper o : getOpps()){
if(o.opp.Id == changedOpp){
o.status = 'modified';
}
}
}
public Boolean getShowTable(){
Boolean show = true;
if(opps.size() == 0 ){
show = false;
}
return show;
}
public void sortTable(){
transient List<oppWrapper> sortedOpps = new List<oppWrapper>();
transient Map<String, List<oppWrapper>> stringMap = new Map<String, List<oppWrapper>>();
system.debug('--------------This is the debug line to watch--------------------');
system.debug('sColumn: ' + sortColumn);
if(sortColumn == 'StageName'){
for(oppWrapper o : getOpps()){
Object oField = o.opp.get(sortColumn);
String fieldValue = (String)oField;
if(stringMap.get(fieldValue) == null) {
stringMap.put(fieldValue, new List<oppWrapper>());
}
stringMap.get(fieldValue).add(o);
}
transient List<String> keys = new List<String>(stringMap.keySet());
keys.sort();
for(String key:keys){
sortedOpps.addAll(stringMap.get(key));
}
//reverse order
if(sortOrder.get(sortColumn) == 'asc'){
sortedOpps.clear();
for(Integer i = (keys.size()-1);i >= 0; i--) {
sortedOpps.addAll(stringMap.get(keys.get(i)));
}
}
if(sortOrder.get(sortColumn) == 'asc'){
sortOrder.put(sortColumn,'desc');
}else{
sortOrder.put(sortColumn,'asc');
}
}
system.debug('sortedOpps: ' + sortedOpps);
system.debug('Opps: ' + Opps);
opps = sortedOpps;
}
public class oppWrapper{
public Opportunity opp {get; set;}
public String status {get; set;}
//Contructor
public oppWrapper(Opportunity opp){
this.opp = opp;
}
}
}
First let's show it working correctly:
1) Open up this page and open the System Log.
2) Click the Stage Name header. This passes a param to the variable "sortColumn" in the controller and calls the action method sortTable().
3) Monitoring the debug log you can see that this is correctly being passed over: line 41, column 9: sColumn: StageName
Now let's show it not working:
1) Reload the page.
2) Change the Stage of the first opp in the table. This runs the change() method in the controller and rerenders the contents of the Status column. A 'Y' should appear in the row of the edited opp.
3) Click the Stage header to sort. The table will disappear because the sort logic did not execute. If you look at the system log you can see that the param was not passed to the controller and sortColumn is null: line 41, column 9: sColumn: null
Now the fix. I don't know why or how this fixes it but it does. Simply adding the name attribute to the param component does the trick. It doesn't even matter what the name is, just as long as it is there:
Change this: <apex:param value="StageName" assignTo="{!sortColumn}" /> to this: <apex:param name="asdfasd" value="StageName" assignTo="{!sortColumn}" /> and it works.
So there you go. I'm pretty sure this is a bug but if it's not I'll modify the title.
-Jason
Message Edited by TehNrd on 01-16-2009 12:04 PM
- TehNrd
- January 16, 2009
- Like
- 1
- Continue reading or reply
How to handle the error when inputText is set to incorrect data type?
j_id0:j_id1:j_id2: An error occurred when processing your submitted information.
...and the page appears to do nothing, no displayed errors or anything:
It would be great if the VF page automatically displayed an error message similar to what is does for inputFields. Something like "Invalid Integer" or what ever data type it is supposed to be. I've attached code below that compares the behaviors.
What should I do to handle this? Its looking like I will have to use a string variable and then convert that to an integer but then I will need to catch any errors if the conversion fails which intern requires more unit tests. More work than I'd like to do if possible.
Ideas, thoughts?
//When you enter an invalid probability it lets you know. If you enter an invalid integer it gives no warning. <apex:page controller="input"> <apex:outputPanel id="panel"> <apex:form> <apex:inputText value="{!numberEntry}" /><br/> <apex:inputField value="{!opp.Probability}" /><br/> <apex:commandButton action="{!submit}" value="Submit" rerender="panel"/> </apex:form> </apex:outputPanel> </apex:page> public class input { Integer numberEntry; public Integer getNumberEntry() { return numberEntry; } public void setNumberEntry(Integer numberEntry){ this.numberEntry = numberEntry; } Opportunity opp = new Opportunity(); public Opportunity getopp() { return opp; } public PageReference submit() { system.debug(numberEntry); system.debug(opp.probability); return null; } }
Message Edited by TehNrd on 05-01-2008 10:42 AM
- TehNrd
- May 01, 2008
- Like
- 0
- Continue reading or reply