Difference between revisions of "Use a Button to Create a Level 2"
From SmartWiki
(9 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | {{JavaScript Syntax}} | ||
[[System Administrator]]s can create a button that will allow users to create {{l2}} records on the fly. | [[System Administrator]]s can create a button that will allow users to create {{l2}} records on the fly. | ||
Line 10: | Line 11: | ||
word-wrap: break-word;"><script language=javascript> | word-wrap: break-word;"><script language=javascript> | ||
function createNewLevel2(){ | function createNewLevel2(){ | ||
− | location.href="/Apps/app_editevent.jsp?appid= | + | location.href="/Apps/app_editevent.jsp?appid=@apptype@&islevel2=1&objecttype=23&nextlevel=1&companyid=@companyid@&objectid=@opportunityid@&eventid=0"; |
} | } | ||
</script> | </script> | ||
Line 19: | Line 20: | ||
* ''appid'' = the [[application ID]] of the {{UTA}} in which the {{l2}} should be created | * ''appid'' = the [[application ID]] of the {{UTA}} in which the {{l2}} should be created | ||
* ''Button Label'' should be the text that should show on the button (e.g., "Create New Activity") | * ''Button Label'' should be the text that should show on the button (e.g., "Create New Activity") | ||
− | * the other | + | * the other parameters should be left exactly as shown: |
:*''companyid=@companyid@'' will associate the organization associated with the {{l1}} record on which the button was pressed with the new {{l2}} record | :*''companyid=@companyid@'' will associate the organization associated with the {{l1}} record on which the button was pressed with the new {{l2}} record | ||
:*''objectid=@opportunityid@'' will link the new {{l2}} record to the {{l1}} record on which the button was pressed | :*''objectid=@opportunityid@'' will link the new {{l2}} record to the {{l1}} record on which the button was pressed | ||
:*''eventid=0'' will create a new, blank {{l2}} record | :*''eventid=0'' will create a new, blank {{l2}} record | ||
+ | |||
+ | '''other parameters that can be included''': | ||
+ | * ''defaultstatusid'' = the [[Determining the statusid|status ID]] to which the new record should be set. If this parameter is omitted the default status will be used. | ||
+ | * ''eventtypeid'' = the [[Determining_the_typeid#Level_2_Type|Type ID]] with which the new record should be associated. If this parameter is omitted the default type will be used. | ||
This {{ROSV}} field can then be referenced in a [[list view]]: | This {{ROSV}} field can then be referenced in a [[list view]]: | ||
Line 38: | Line 43: | ||
==See Also== | ==See Also== | ||
* [[Adding a Button that Runs a JavaScript]] | * [[Adding a Button that Runs a JavaScript]] | ||
+ | * [[Use a Button to Create a Level 1]] | ||
[[Category:JavaScript]] | [[Category:JavaScript]] |
Latest revision as of 19:17, 7 April 2015
This feature uses JavaScript syntax |
System Administrators can create a button that will allow users to create Level 2 records on the fly.
Steps:
- On the Level 1, create a custom field of type Read Only – System Variables
- In the Variables section, enter the following:
<script language=javascript> function createNewLevel2(){ location.href="/Apps/app_editevent.jsp?appid=@apptype@&islevel2=1&objecttype=23&nextlevel=1&companyid=@companyid@&objectid=@opportunityid@&eventid=0"; } </script> <input type="button" class=Button value="Button Label" onClick="createNewLevel2()">
where:
- appid = the application ID of the in which the Level 2 should be created
- Button Label should be the text that should show on the button (e.g., "Create New Activity")
- the other parameters should be left exactly as shown:
- companyid=@companyid@ will associate the organization associated with the Level 1 record on which the button was pressed with the new Level 2 record
- objectid=@opportunityid@ will link the new Level 2 record to the Level 1 record on which the button was pressed
- eventid=0 will create a new, blank Level 2 record
other parameters that can be included:
- defaultstatusid = the status ID to which the new record should be set. If this parameter is omitted the default status will be used.
- eventtypeid = the Type ID with which the new record should be associated. If this parameter is omitted the default type will be used.
This Read Only – System Variables field can then be referenced in a list view:
...on reports...
...or on the Level 1 record itself: