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
desmoquattrodesmoquattro 

Javascript Events on Standard Page Layouts

Hi everyone. I'm using the standard page layout (e.g. no VisualForce) with Contact records. I'm tracking email and a custom field for an external application's username. When someone creates a new Contact record and enters the contact's email address, I'd like that action (e.g. Javascript OnBlur()) to cause the username field to be pre-populated with the email address. I know how to do this with Javascript, but I'm wondering where the best place to put it is?

 

On the face of it, I thought I might write a VisualForce page containing the Javascript and add it to the standard layout in a section. But that would lead to wasted space on the page.

 

How have people handled this before? Are there any best practices?

 

Thanks!

shillyershillyer

Why not use workflow with a field update action? When the contact record is saved, the username field will be updated with email address value.

 

Hope that helps,

Sati

desmoquattrodesmoquattro

Thanks Sati. I had thought of that too, but this needs to be real-time feedback for the user. It's like the "suggest a username" functionality you often see when registering on a website...except on a contact record in Salesforce :)