Difference between revisions of "Post Selection JavaScript"

From AgileApps Support Wiki
imported>Aeric
m (Text replace - 'Data & Presentation > Objects' to 'Data > Objects')
imported>Aeric
Line 1: Line 1:
[[Lookup]] fields have the additional ability for validations using JavaScript.  
[[Lookup]] fields have the additional ability for validations using [[JavaScript]].  


:''Compare to [[Form Scripting]] and [[Field Scripting]]''
:''Compare to [[Form Scripting]] and [[Field Scripting]]''
Line 46: Line 46:
:* Use [[AJAX and REST]] to communicate with the platform in JavaScript code.
:* Use [[AJAX and REST]] to communicate with the platform in JavaScript code.
:* [[Global JavaScript Variables]]
:* [[Global JavaScript Variables]]
<noinclude>
[[Category:JavaScript]]
</noinclude>

Revision as of 19:17, 7 October 2011

Lookup fields have the additional ability for validations using JavaScript.

Compare to Form Scripting and Field Scripting

Post Selection JavaScript is available in:

  • Custom Objects
  • System Objects:
  • Accounts
  • Documents
  • Templates
  • Contacts
  • Prospects
  • Opportunities
  • Price Books
  • Products
  • Contracts
  • Cases
  • Users
  • Campaigns
  • Projects

Editing Lookup Scripts

Follow these steps to add or change scripting for a lookup field:

  1. Click Designer > Data > Objects > {object} > Fields
  2. Click the name of the Lookup field.
  3. Enter or change the code in Post Selection JavaScript.
  4. Click the Save button.

Writing Lookup Scripts

In the JavaScript code, the following variables are available:

  • id: The identifier of the selected record
  • name: The label of the selected record
  • window.opener.document.mainForm: The opener form and its fields

This example displays the label of the selected record.

alert("You have selected record: " + name);

Learn More