Node.insertBefore(options)
Method Description |
Inserts a new child node before an existing child node for the current node. If the new child node is already in the list of children, this method removes the new child node and inserts it again. |
Returns |
|
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Since |
2015.2 |
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
required |
The new child node to insert. |
|
|
required |
The node before which to insert the new child node. If |
Errors
Error Code |
Message |
Thrown If |
---|---|---|
|
HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. |
Node cannot be inserted. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/xml Module Script Samples.
//Add additional code
...
var insertednode = parentNode[0].insertBefore({
newChild : elemlist1[0],
refChild : elemlist2[0]
});
...
//Add additional code