Post your questions here
8:00 AMHello ppl,
Post your questions on Visualforce development and any other related topics on Salesforce that you need quick help with.
Expect the quickest of quick response!!!
Hello ppl,
Post your questions on Visualforce development and any other related topics on Salesforce that you need quick help with.
Expect the quickest of quick response!!!
51 comments
Can I write a VF Code to Redirect a user on another VF page after the execution of standard action method on commandButton click?
ReplyDeleteYes you can certainly do that... You will have to use an extension class...
ReplyDeleteOn the commandbutton you will have to call a method.. this method will call the standard controller's save method and then redirect... hope this answers you..
Hi,
ReplyDeleteI am trying to create a program in visualforce with ajax tool. The program will update the record before viewing its details. Here is my sample code:
apex:page standardController="ObjectTest__c"
script src="/soap/ajax/15.0/connecton.js" type="text/javascript"/script
script src="/soap/ajax/15.0/apex.js" type="text/javascript"/script
script
sforce.connection.sessionId = "{!$Api.Session_ID}";
var u = new sforce.SObject("ObjectTest__c");
u.Id = "{!ObjectTest__c.Id}";
u.Field_To_Update__c = 'Hello';
result = sforce.connection.update([u]);
/script
apex:detail relatedList="true" /
>/apex:page<
The problem is, although the update has been made, it display the un-updated data. I have to view again the page inorder to see the update.
Question, how can I achieve displaying the detail page with the updated data without reloading the page?
Thank in advance.
Hi Juan,
ReplyDeleteYou can call a reload method at the end of your script..after this line --
result =sforce.connection.update([u]);
add this line --
window.location.reload( false )
If this does not work you can use an extension class and call an action method in the apex:page tag.. Do your update in the action method
Hope this helps..
Thanks success, but window.location.reload(false) keep my page reloading.
ReplyDeleteI also tried to use an extension class and have the update their but the problem is the update didn't update the record.
here the update code on my apex class extensions:
u = [select Field_To_Update from ObjectTest__c where id = :idPassFromVFPage];
u.Field_To_Update = 'Hello';
update u;
The update don't have an effect.
For more info about my problem.
ReplyDeleteScenario:
Upon viewing the detail page of the ObjectTest__c, the Field_To_Update will be updated first. The value for this field will come from another website. I created a javascript that will pull out the required value and pass the extracted value into the VisualForce page. Then update will take place. The detail page should display the updated record.
As your suggestion, that I can use extension class and call the action method in apex:page tag. But this will not work because the value of the field to be updated is inside the page.
I hope you can help me.
Hi Juan,
ReplyDeleteYes i understood your problem clearly. I believe you cannot use an extension class as you are using javascript for the update.
So, lets try one more approach.. Lets seperate the update and the detail page apart.. Create two visualforce pages one containing only the javascript and one containing only the detail tag... In your javascript add the last line to redirect to the second VF page..i think window.location.href('\apex\VFpage2') is the syntax..
Hope i dint confuse.. try it and let me know..
Thanks,
Edwin
Hi Juan,
ReplyDeleteMaybe you can also try using a onclick javascript instead of visualforce.. Not sure if that is what might help you but just in case.. I believe you are overriding the "View" button
Hi success,
ReplyDeleteI just tried adding window.location.href('/apex/MyPage2')
but it gives me an error window.location.href is not a function. I tried window.location.href = "/apex/MyPage2" it worked reloading the page. But the problem is the whole page will reload. Is it possible only the content frame will be reloaded.
I tried also to use the apex:include tag to include my second page, but the details displaying is still not updated.
Yes, you are right, I'm trying to override the "View" button
Yes juan, the page has to be reloaded to show the updated information..
ReplyDeleteBut since we have only the content in a separate VF page i think this should not be a problem.. Only thing is that two page loads have to happen.. I could'nt think of a better way to do this.. Will let you know if i come across one..
Hi..Hoping you can help. I have a URL in a custom field within contact record.
ReplyDeleteI'm trying to use a custom merge field to embed the URL inside an anchor tag so that I have an active link presented in the message section of my Self Service Portal home page.
The syntax is simple enough:
Personal Website
BUT after I save the Home Page Settings the curly braces and exclamation mark are converted to their numeric equivalents (%7B%21 and %7D). Obviously this doesn't work!
Do you have any ideas how I can get past this? I'm stumped and Salesforce support told me it's beyond the scope of their role.
Thanks
Craig
Hi Craig..
ReplyDeleteJust to clarify.. Where do you display the URL finally.. Is it by using Home Page Layout components... Or are you using a Visualforce page as a home page component..
If you are using the first option then obviously the URL would'nt work.. Because it would'nt know from where to fetch the merge field..
Let me know...
Hi again,
ReplyDeleteMy idea is to try overriding the standard list controller adding a javascript to update the records when the user click the specific record. But how can I can retain its display format?
Hi...
ReplyDeleteTry using a apex:outputtext escape="true" value="{!contact.field} ... instead of just displaying the value..not sure if it would work
Hi,
ReplyDeleteHow do i use accesskey attribute outputlink in visualforce page. Can anyone give any sample code for generating keys for dynamic values.
Hey... Accesskey is used to tell your browser that by pressing a specific key the focus should be set on the outputlink.. After pressing your accesskey and you hit "Enter".. your outputlink opens up...
ReplyDeleteIts more like the way when you press TAB and the focus shifts from one component to another...
Hello, I'm having a problem which nobody seems to be able to answer. I've posted about it on the VisualForce community forum. I'm looking for a tutorial or a how to in terms of migrating my existing application into a Force.com application. I have JSPs coded that need to be translated into apex/visualforce pages. Can you help point me in the right direction? Thanks much.
ReplyDeleteHello!! I do not have much knowledge about JSP's.. Anyhow, i think you will have to convert your JSP code into Apex and your HTML into Visualforce.. I am not sure if you could reuse your existing code, i think you will have to rebuild your app from the scrap.. I would recommend you to start off by first building the UI by using Visualforce, and then building the functionality using Apex
ReplyDeleteHi Love this site... I would like to know how would one do a custom report based on 3 separate piclist values. Like first you have 3 picklist values, then a button to say run report, like Accounts and Contacts report comes up based on those 3 picklist values... Do you have something like this?
ReplyDeleteHi Salat.. Thanks for your comments!! Is this something that you cannot achieve with the standard Accounts with Contacts report?? If yes then this article might help you a bit http://www.forcetree.com/2009/07/database-search-and-selection.html
ReplyDeleteHi! My name is Sookie...
ReplyDeleteThis appears to be an excellent site.
I need help in making new pages with database integration. I'm quite a newbie about Salesforce and Apex. I was wondering how to create my own page that has some sort of a search function.
For example, I have a table for students, in the page, there is a required field named, student id. Once a person enters a particular student id, all the details of the given student will be retrieved from the table and be displayed in the page. I need code for the page and for the controller class. Thanks!
Hi Sookie..
ReplyDeleteThanks for your comments!!
My suggestion would be to use the standard sidebar search that comes with Salesforce whenever possible..
But in case you need a more complex search that is not possible with the Standard search, then have a look at this article Click here ..
This article may be a bit complex to understand at first.. Do write to me in case you have any difficulties at success.salesforce@gmail.com
Cheers!! Edwin
Hi,
ReplyDeleteI'm trying to create a visual force page for a web to lead form. As long as I only use standard lead fields, it works fine. As soon as I add custom fields, it breaks. It does not render them into the html, and when I try to set values to the hidden fields via javascript it fails because they do not exist. Any advice?
Hello !!!
ReplyDeleteWeb to lead forms should work with both custom and standard fields... How do you generate the HTML form?? Can u send the code to me at success.salesforce@gmail.com so that i could have a better idea of the problem..
I'm new to VF, but I've got decent experience in DB/App development, and I've got one key question I'm curious about...
ReplyDeleteThere are a lot of situations where I want people to be able to select from a set of options, but rather than a hard-wired SF "picklist", I'd actually like those options to records in their own custom object table.
For example, I've got a custom object for "Data Feeds", where any given account might have 3 or 4 unique Data Feeds associated with it. Each Data Feed, though, is coming from a handful of "Data Providers"...which are also their own custom object type.
Right now, I can build a simple batch-edit page in VisualForce where I'm looking at 25 Data Feeds in a form table, and for any _picklist_ fields, each row in the table has a little pull-down menu, which makes it very easy to quickly pick and choose an option for each Feed. The "Data Provider" field, though, shows up as a look-up box, and you have to click on each one, summon the look-up dialog, pick an option, etc. (I know you could also paste/type the values in directly, but that's not exactly ideal, either.)
Is there a straightforward way to populate a pull-down menu with a list of records from another customer object table (and have the associations get established correctly?)
Thanks in advance for any help, and nice site!
(Oh...and, of course, the other possibility -- and the better option for a look-up where there are a lot of possible records to select -- would be a type-ahead mechanism. Any thoughts on that?)
ReplyDeleteThanks again.
Hello LairBob!!
ReplyDeleteI guess you are using an apex:inputfield for "Data Provider". To make things easier, you can make the "Data Provider" column in the table as a "SelectList". Your controller can then query the custom object and populate the list with relevant values...
Here is an example of populating a list with values from a custom object Click here!
Also, there is an excellent example from Tehnrd for a type-ahead solution.. Click here .. I believe this solution would suit you best..
Thanks for watching this site..
Regards,
Edwin
Oh, hey -- thanks so much. I totally spaced on coming back and checking for an answer till today, so I haven't had a chance to try this out, but I definitely appreciate it, and I'll give it a shot tonight.
ReplyDeleteThanks!!
OK, so now I've got a different question (as long as you're being so helpful) -- I'm trying to define a custom component to re-use as a section across different VF pages, and this module has to have a bunch of date inputs in it. I understand that for text and number fields, I can just bind the fields to attributes of the component, and use "InputText" or whatever, but apparently, there's no native "InputDate" Apex component.
ReplyDeleteI read the thread on DeveloperForce that I think you were part of ( http://community.salesforce.com/t5/Visualforce-Development/Date-Picker-inVisualForce/m-p/80966/message-uid/80966 ), but Jill's recommended "work-around" seems kind of laborious, especially if you want to have 7 or 8 date fields in a given component. (Wouldn't you need to create just as many "empty" sObjects?) Is there something I'm missing?
Hi,
ReplyDeleteIs there some way to do field validation on a VF page? I have a created a customized email form which has a required field. Apparently, I can send the email without entering anything in the required field. Ideally, what I'd would like is an alert/message that tells the user - "Please enter ..blah..blah" if they skip the required field. Any suggestions or help is greatly appreciated. Thank you.
Hey,
ReplyDeleteI have records in a pageblocktable which I need to do significant styling logic work on. Is there a way to work out which record i'm working with when i get back to the controller.
Thanks.
sir, how can i use paging technique on vf???
ReplyDeletepls Xplain with simple Xample....nd code.
Hi Success,
ReplyDeleteI am a new bee for the VF and Apex. Trying something on my dev profile. If I use a tab and create a form to save records.. that works fine.The standard Save function works. But if I use the same code in that does not save the record and redirects to some other page.
Thanks for your help in advance.
i want to use select redio button in pageblock table
ReplyDeletecan you help me
You can't use a selectradio inside a table, even if you use the selectradio is considered to be only for that particular row and not the table.. To deal with this have a look at this http://www.forcetree.com/2011/09/radiobutton-in-datatable-in-visualforce.html
ReplyDeleteI have created 2 custom objects - 'user details' and 'salary'. In user details I have this field employee id. If I am searching for some user by entering its employee id,I want to display the salary details of the user in the search table too.
ReplyDeleteAs I am new to salesforce.com, can anyone please give me the code for this??
I have created 2 custom objects - 'user details' and 'salary'. In user details I have this field employee id. If I am searching for some user by entering its employee id,I want to display the salary details of the user in the search table too.
ReplyDeleteAs I am new to salesforce.com, can anyone please give me the code for this??
Can we get a sample code\presentation for Rest Api like writing a java program to connect to sfdc
ReplyDeleteI do not have a rest API code yet. You might want to check out the Wed services integration doc in the meantime here
ReplyDeletehttp://www.forcetree.com/2011/12/java-to-salesforcecom-integration-using.html
im hoping some one to help me im university student and my project on salesforce
ReplyDeletemy order is how i can display object(table) any object not condition user object to my visualforce page by query and how making login page not page of normal user
but other user that i created (another object) when clicked on login button it check the username and pasword if they exist in object he enter to another page.
Can I create a pdf on the fly that can change the position of a "header" in the page itself?
ReplyDeleteCan I create a picklist that will modify (in the same pdf page) the "Size" or the "Type" of a text board belowe it?
Please can any one say me about How to create Dependent pick-list by visual force pages and class , i have tried but still i am messing the code of the Dependent pick-list Please can any one tell me the code of Dependent Picklist or send me the related list of Dependent Picklist
ReplyDeleteHello... Hope this solves your problem http://developer.force.com/releases/release/Summer10/Dependent+Picklists+for+Visualforce
Deleteplease can you send the brief idea of picklist i want to create dependent pick-list through custom visualforce pages and class ,like i have taken two picklist country and state
Deletein country india ,usa ,canada ; and in state AP, up, washington ,california, saint john,nova
i am trying this by one custom object name : Application,and one class name :Application
please can any provide me a sample code according to the above requirement
HI
ReplyDeleteI WANT TO CREATE DEPENDENT PICKLIST, CAN ANY ONE TELL ME HOW TO CAEATE DEPENDENT PICKLIST THROUGHT VISUALFORCE PAGES AND CLASS ,
PLEASE GIVE ME RESPONSE AS SOON AS POSSIBLE
I want to create empty table like without data.how to create that one?
ReplyDeleteHi Guys,
ReplyDeleteI Want to know can we create many to one relation between the standard object and custom object...IF so can you tell me How??
Yes, you can create may to one relation between standard obj and custom obj... by creating a master-detail relationship between the same...
DeleteHi guys,
ReplyDeleteIam creating app for educational insitution...i have created a page like website,,now it want to create a panel..if i click any dropdown menu changes will be in same panel
pls help me
I want to fetch Company's country and state list in drop down list.
ReplyDeleteI want to create one custom button. when i click on that new page should be open with drop down list.
Hi i want to insert a record in 2 diff orgs by using VFPage that is dynamic insertion in json format how it is .. if possible please provide sample code
ReplyDelete