function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MMNMMN 

Update field A when onBlur field B (working on Case)

Hi

 

I'm really new working on SF so I have some troubles doing that. If I had to do that in JS and HTML it would be really easier ^^

 

As I said, I'm working with Cases. I have to update a field called "Contact Name" (lookup) as soon as I complete the "Account Name" field, doing a SOQL query.

Problem is I don't know how to do that.

 

At first, I hope that I could be able to do that without overwrite the "New" button, using Formula or something else.

 

Finally, I had to overwrite the "New" button. But now my VF page is done, I don't know how to update field A when field B is completed ... I tried using JS or Apex/reRender method.

 

Here is the minimal code :

 

<apex:page standardController="Case" tabStyle="Case">
	<apex:form>
		<apex:pageBlock title="" mode="edit">
			<apex:pageBlockSection columns="2" title="My title">
				<apex:pageBlockSectionItem>
					<apex:outputLabel
						value="{!$ObjectType.Case.fields.Account_Name__c.label}"
						for="Account_Name__c" />
					<apex:inputField id="Account_Name__c" value="{!Case.AccountId}"
						required="true" />
				</apex:pageBlockSectionItem>
				<apex:pageBlockSectionItem>
					<apex:outputLabel
						value="{!$ObjectType.Case.fields.ContactId.label}" for="Contact" />
					<apex:inputField id="Contact" value="{!Case.ContactId}" />
				</apex:pageBlockSectionItem>
			</apex:pageBlockSection>
		</apex:pageBlock>
	</apex:form>
</apex:page>

 

 

By the way, excuse if my english is approximative, that's not my native language, but I'm working on it ^^