Advanced Search
If you are creating the module through Module Builder, just add 'file' => 1, to the 'templates' array in $config variable (config.php). Then you'll be able to add a new upload file field to your editviewdefs.php:
1 =>
array (
'name' => 'uploadfile',
'displayParams' =>
array (
'onchangeSetFileNameTo' => 'document_name',
),
),
Don't forget to add the form and javascript elements to the templateMeta array in editviewdefs.php:
'form' =>
array (
'enctype' => 'multipart/form-data',
'hidden' =>
array (
),
),
'javascript' => '<script type="text/javascript" src="include/javascript/popup_parent_helper.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="include/javascript/sugar_grp_jsolait.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="modules/Documents/documents.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>',
You also need to add the uploadfile field to detailvidefs.php:
1 =>
array (
'name' => 'uploadfile',
'displayParams' =>
array (
'link' => 'uploadfile',
'id' => 'id',
),
),
Hope this helps!
you can use push
function:
myarray.push([123, 432, 233, 98]);
to add whole array to your array or to add individual items:
myarray.push(123, 432, 233, 98);
To add to specific location, you would need to use splice()
function.
Docs:
Google Apps Script is based on JavaScript so you could use the JavaScript array methods to achieve your goal, like unshift.
How can I add new array elements at the beginning of an array in JavaScript?
Javascript allows you to add attributes dynamically, like this
previousCreatedObj.newAttr = [];
previousCreatedObj.another = 2
Or, if your object is and array just add an index. previousCreatedObj[0].yetAnother = 1
To add items to an array use push
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/push
Using Array.unshift() seems like the way to go to add it to the 0 position.
Should you want to add it to the end of the array, use Array.push()
To add it to a specific position, Array.splice() would work.
You can add any data type to the array, so inserting an array inside another is not a problem.