You need to sign in to do that
Don't have an account?
Art Saber
Question on custom button to fill out fields from multiple pages
I would like to create a button on an opportunity detail page. The buttom will lead to a page to update fields, which the fields are sitting on the opportunity detail page and the account detail page.
I do not know where to start on this. Help/direction will be much appreciated.
I do not know where to start on this. Help/direction will be much appreciated.
https://help.salesforce.com/articleView?id=salesforce_help_map.htm&type=0
1. apex page that should be created
<pre>
<apex:page standardController="Opportunity" sidebar="true">
<apex:sectionHeader title="User Edit" subtitle="New User" />
<!-- Begin Form -->
<apex:form >
<apex:pageBlock title="User Informations" mode="edit">
<apex:pageBlockSection columns="2" showHeader="true" title="Information">
<!--using syntax as {!OPPORTUNITY.PUT_API_NAme_OF_Editbale_Field} will give editbale
fields-->
<apex:inputField id="firstName" value="{!Opportunity.Name}" required="false" />
<!--put the field to be updated in this fashion, for details go thru the documentation-->
<!--apex:inputField allows to see the fields in Edit mode-->
<!--to get the Account Fields in edit mode you will have to use the API name of Account Object
Example if website of Account should be edited , check API name of website field and than use below syntax
{!Opportunity.Account.Website}
-->
<apex:inputField id="lastName" value="{!Opportunity.AccountId}" required="false" />
</apex:pageBlockSection>
<apex:pageBlockButtons >
<!-- this button will give you save fucntionality-->
<apex:commandButton value="Save" action="{!save}" rerender="error"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
</pre>
2. Create new button for opportunity.
here is documenttaion from salesforce. it is step by step , should be easy.
Note: You will have to change the content of URL window as follows -
/PUT_YOUR_VF_PAGE_Name_HERE?id={!Opportunity.Id}
3. Add the Button to layout.
Test it out! this should work.
All Answers
1. write VF page that accepts opportunity ID
2. USe standard controller (than only it will be available to use as a button at Opportunity layout) as opportunity and an extension apex class
3. Write logic in apex class (extension) to grab fields of related object in extension
4. Create a custom button and use the VF page created at #1
5. Good to go!
Let me know if you face any challenges.
Thank you.
https://help.salesforce.com/articleView?id=salesforce_help_map.htm&type=0
1. apex page that should be created
<pre>
<apex:page standardController="Opportunity" sidebar="true">
<apex:sectionHeader title="User Edit" subtitle="New User" />
<!-- Begin Form -->
<apex:form >
<apex:pageBlock title="User Informations" mode="edit">
<apex:pageBlockSection columns="2" showHeader="true" title="Information">
<!--using syntax as {!OPPORTUNITY.PUT_API_NAme_OF_Editbale_Field} will give editbale
fields-->
<apex:inputField id="firstName" value="{!Opportunity.Name}" required="false" />
<!--put the field to be updated in this fashion, for details go thru the documentation-->
<!--apex:inputField allows to see the fields in Edit mode-->
<!--to get the Account Fields in edit mode you will have to use the API name of Account Object
Example if website of Account should be edited , check API name of website field and than use below syntax
{!Opportunity.Account.Website}
-->
<apex:inputField id="lastName" value="{!Opportunity.AccountId}" required="false" />
</apex:pageBlockSection>
<apex:pageBlockButtons >
<!-- this button will give you save fucntionality-->
<apex:commandButton value="Save" action="{!save}" rerender="error"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
</pre>
2. Create new button for opportunity.
here is documenttaion from salesforce. it is step by step , should be easy.
Note: You will have to change the content of URL window as follows -
/PUT_YOUR_VF_PAGE_Name_HERE?id={!Opportunity.Id}
3. Add the Button to layout.
Test it out! this should work.
Thank you in advance.
if it is you will have to change the VF page tag from inputField to outPutfield or outputText.
inputField is binded to accept values from the page.
The custom fields are editable and data manually entered but the api for these fields are linked to formula fields.
can you send your code and the api name of the field details that you are trying to refer?
<apex:form >
<apex:pageBlock mode="edit">
<apex:pageBlockSection columns="2" showHeader="true" title="{!opportunity.name}">
<apex:inputField value="{!Opportunity.Amount}" required="false"/>
<apex:inputField value="{!Opportunity.LOI_in}" required="false"/>
</apex:pageBlockSection>
<apex:pageblock >
<apex:commandButton value="Save" action="{!save}" rerender="error"/>
<apex:commandButton value="Cancel" action="{!cancel}" rerender="error"/>
</apex:pageblock>
</apex:pageblock>
</apex:form>
</apex:page>
you are using wrong API name
correct api name is suffixed with __c
change this as -
<apex:inputField value="{!Opportunity.LOI_in__c}" required="false"/>
please see below comments in code provided above
<pre>
<!--to get the Account Fields in edit mode you will have to use the API name of Account Object
Example if website of Account should be edited , check API name of website field and than use below syntax
{!Opportunity.Account.Website}
-->
<apex:inputField id="lastName" value="{!Opportunity.AccountId}" required="false" />
</pre>