Examples
instanceVarDir returns the absolute path to the instanceβs folder on the server, e.g. /usr/local/neolane/nl6/var/instance1. Use it to build file paths instead of hardcoding them, so the same script runs unchanged across instances and environments. For the upload subfolder specifically, prefer π instanceUploadDir.
It is available as a read-only string on the application singleton, set by the deployment and not changeable from script.
Build a path under the instance folder
Create path for temporary or working files to the var folder rather than an absolute path:
var rejectFile = application.instanceVarDir + "/" + getUUID() + ".csv"; // /usr/local/neolane/nl6/var/instance1/3f2a...csvIn a workflow attribute
when used in a workflow activity:
<%= application.instanceVarDir %>/<%= [email protected]() %>_<%= formatDate(new Date(), "%4Y%2M%2D") %>.csv
Unit tests
Tested with acc by running
acc instance exec -f test/integration/instanceVarDir.spec.js in a sandbox:
loadLibrary("/nl/core/shared/nl.js"); // import NL.assert
context.test1 = NL.assert(typeof application.instanceVarDir === "string");
context.test2 = NL.assert(application.instanceVarDir.length > 0);See also
-
π instanceName- The name of the current Adobe Campaign instance, as a read-only string. -
π instanceUploadDir- The absolute path to the instance upload folder, as a read-only string.