Quantcast
Viewing all articles
Browse latest Browse all 79901

How can I populate QuickCreate form records with data from a parent record using a jscript OnLoad event?

Hello,

When a user sets the "Scope" on an Opportunity record to "Parent Opportunity", a grid appears that allows the user to create child Opportunity records associated with the parent.  I am trying to create a web resource for an OnLoad event that will auto-populate the Opportunity Name, Contact, and Account of the QuickCreate form with the data that is in the Parent Opportunity form.  Account and Contact are lookups to separate entities, and Opportunity Name is a text field.  Here is what I have so far: 

function SetLocalStorage(executionContext)

{

 

var formContext = executionContext.getFormContext();

var account = formContext.getControl("ParentAccountId").getAttribute().getValue();

var contact = formContext.getControl("ParentContactId").getAttribute().getValue();

var oppname = formContext.getControl("new_name").getAttribute().getValue();

 

localStorage.setItem("Account", account);

localStorage.setItem("Contact", contact);

localStorage.setItem("OpportunityName", oppname);

 

}

I am fairly new to JavaScript and am not really sure what to add to the web resource in order for the QuickCreate form to auto-populate.  Any help would be greatly appreciated.

Thanks!


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>