Difference between revisions of "Post Selection JavaScript"
From LongJump Support Wiki
imported>Aeric |
imported>Aeric m (Text replace - 'Designer > Data >' to 'Designer >') |
||
(2 intermediate revisions by the same user not shown) | |||
Line 23: | Line 23: | ||
Follow these steps to add or change scripting for a lookup field: | Follow these steps to add or change scripting for a lookup field: | ||
# Click '''Designer | # Click '''Designer > Objects > {object} > Fields''' | ||
# Click the name of the [[Lookup]] field. | # Click the name of the [[Lookup]] field. | ||
# Enter or change the code in '''Post Selection JavaScript'''. | # Enter or change the code in '''Post Selection JavaScript'''. | ||
Line 39: | Line 39: | ||
:{| | :{| | ||
<pre> | <pre> | ||
alert("You have selected record: " + name); | alert("You have selected record: " + name);</pre> | ||
</pre> | |||
|} | |} | ||
===Learn More=== | ===Learn More=== | ||
Line 46: | Line 45: | ||
:* 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]] | ||
:* [[JavaScript#Accessing_Additional_Lookup_Variables_in_a_Form|Accessing Additional Lookup Variables in a Form]] | |||
<noinclude> | <noinclude> | ||
[[Category:JavaScript]] | [[Category:JavaScript]] | ||
</noinclude> | </noinclude> |
Latest revision as of 23:33, 22 June 2012
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
- Built-in or CRM 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:
- Click Designer > Objects > {object} > Fields
- Click the name of the Lookup field.
- Enter or change the code in Post Selection JavaScript.
- 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
- Field Name and Field Value syntax
- Use AJAX and REST to communicate with the platform in JavaScript code.
- Global JavaScript Variables
- Accessing Additional Lookup Variables in a Form