-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
2Questions
-
0Replies
How to show account details in another form of Visualforce Page
In Visualforce Page i created a two form. In first form i called field set to create contact and in second form i have to show the related account details of contact. And we are able to update both contact and account in same page. but i am not able to show related account details in 2nd form.
here is my code:
Controller class:
here is my code:
<apex:page Controller="DemoController1" showHeader="false"> <html> <h1><center><font size="8"><b>Satrang Technologies</b></font></center></h1> <!-- <apex:form id="form1" rendered="{!form1}"> <apex:pageBlock title="Account Details"> <apex:pageBlockSection > <apex:inputField value="{!acc.Name}"/> <apex:inputField value="{!acc.Phone}"/> <apex:inputField value="{!acc.AccountNumber}"/> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton value="save" onclick="myFunction()" action="{!save}"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form>--> <apex:form id="form1" rendered="{!form1}"> <apex:pageBlock title="Contact Details"> <apex:pageBlockSection > <apex:repeat value="{!fields}" var="f"> <apex:inputField value="{!con[f.fieldPath]}" required="{!OR(f.required, f.dbrequired)}"/> </apex:repeat> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton value="save" onclick="myFunction()" action="{!save}" /> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> <apex:form id="form2" rendered="{!form2}"> <apex:pageBlock title="Account Details"> <apex:pageBlockSection > <apex:inputField value="{!acc.Name}"/> <apex:inputField value="{!acc.Phone}"/> <apex:inputField value="{!acc.AccountNumber}"/> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton value="save" action="{!save1}" rerender="form2"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </html> </apex:page>
Controller class:
public with sharing class DemoController1{ public Account acc {set;get;} public Contact con {set;get;} public Boolean form1 {set;get;} public Boolean form2 {set;get;} public DemoController1(){ form1=true; form2=false; con = new Contact(); } public List<Schema.FieldSetMember> getFields() { return SObjectType.Contact.FieldSets.SatarangSet.getFields(); } public pagereference save(){ //form1=false; form2=true; upsert con; return null; } public pagereference save1() { System.debug(acc.id); update acc; return null; } }
- Hunny
- November 27, 2018
- Like
- 0
- Continue reading or reply
Soql to retrive account field in custom object
Hi,
In my Case the senarios is there is custom Object (investment) lookup with contact. In Custom Object when status field is update i have to update account field.
To make that thing possible i have to query account field in custom object trigger but i am not able to fetch accounts field.
Can please someone help how do i do that.
Thanks
PR
In my Case the senarios is there is custom Object (investment) lookup with contact. In Custom Object when status field is update i have to update account field.
To make that thing possible i have to query account field in custom object trigger but i am not able to fetch accounts field.
Can please someone help how do i do that.
Thanks
PR
- Hunny
- November 25, 2018
- Like
- 0
- Continue reading or reply