Skip to content

Project API

Project API lists the projects on the platform, returns the definition of the current project, and updates a project’s GIS (map) location.

Returns every project on the platform — Collection<ProjectResponseDto>.

var projects = ins.getProjects();
projects.forEach(function(p) {
ins.consoleLog(p.getName() + " active=" + p.getIsActive());
});

Returns projects filtered by active / inactive state.

var activeOnly = ins.getProjects(true);

Returns the definition of the current project the script is running in.

var p = ins.getProject();
ins.consoleLog(p.getName() + " @ " + p.getLatitude() + ", " + p.getLongitude());
MethodTypeDescription
getName()StringProject name
getDsc()StringDescription
getIsActive()BooleanWhether the project is active
getAddress()StringAddress (text)
getLatitude() / getLongitude()DoubleGIS coordinate
getIconFileId()StringMap icon file ID
getProperties()StringSerialized extra properties (JSON string)

ins.updateProjectLocation(latitude, longitude) / (projectName, latitude, longitude)

Section titled “ins.updateProjectLocation(latitude, longitude) / (projectName, latitude, longitude)”

Updates the project’s GIS coordinate. projectName defaults to the current project.

// Current project's location
ins.updateProjectLocation(37.9, 32.5);
// Another project
ins.updateProjectLocation("other_project", 41.0, 29.0);

Example: Forward a Mobile Device’s Location to the Project

Section titled “Example: Forward a Mobile Device’s Location to the Project”
function main() {
var lat = ins.getVariableValue("Device_Latitude").value;
var lng = ins.getVariableValue("Device_Longitude").value;
if (lat && lng) {
ins.updateProjectLocation(lat, lng);
ins.writeLog("info", "GIS", "Project location updated: " + lat + ", " + lng);
}
}
main();