Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

JavaScript to add Custom Properties

Jesse Paris edited this page Jul 31, 2017 · 2 revisions
var qrsInteract = require('qrs-interact');

var qrsInteractInstance = new qrsInteract("localhost");

var AppLevelMgmt = {
    "name": "AppLevelMgmt",
    "valueType": "Text",
    "choiceValues": ["Executive", "HR", "PCI"],
    "objectTypes": ["App", "User"]
};

var DataConnectionType = {
    "name": "DataConnectionType",
    "valueType": "Text",
    "choiceValues": ["Admin", "Folder", "MS Access", "ODBC", "Oracle", "PowerToolQVD", "QVD", "SQL Server"],
    "objectTypes": ["DataConnection"]
};

var ManagedMasterItems = {
    "name": "ManagedMasterItems",
    "valueType": "Text",
    "choiceValues": ["Customer Service", "Finance", "Marketing", "Sales"],
    "objectTypes": ["App"]
};

var QlikGroup = {
    "name": "QlikGroup",
    "valueType": "Text",
    "choiceValues": ["Finance", "IT", "Marketing", "QlikAdmin", "Sales"],
    "objectTypes": ["App", "DataConnection", "ReloadTask", "Stream"]
};

var TeamAdmin = {
    "name": "TeamAdmin",
    "valueType": "Text",
    "choiceValues": ["Finance", "IT", "Marketing", "Sales"],
    "objectTypes": ["User"]
};


var newBody = JSON.parse(JSON.stringify(AppLevelMgmt));
qrsInteractInstance.Post("custompropertydefinition", newBody, "json")
    .then(function (result) {
        console.log(result.body);
    })
    .catch(function (error) {
        console.error(error);
    });

var newBody = JSON.parse(JSON.stringify(DataConnectionType));
qrsInteractInstance.Post("custompropertydefinition", newBody, "json")
    .then(function (result) {
        console.log(result.body);
    })
    .catch(function (error) {
        console.error(error);
    });

var newBody = JSON.parse(JSON.stringify(ManagedMasterItems));
qrsInteractInstance.Post("custompropertydefinition", newBody, "json")
    .then(function (result) {
        console.log(result.body);
    })
    .catch(function (error) {
        console.error(error);
    });

var newBody = JSON.parse(JSON.stringify(QlikGroup));
qrsInteractInstance.Post("custompropertydefinition", newBody, "json")
    .then(function (result) {
        console.log(result.body);
    })
    .catch(function (error) {
        console.error(error);
    });

var newBody = JSON.parse(JSON.stringify(TeamAdmin));
qrsInteractInstance.Post("custompropertydefinition", newBody, "json")
    .then(function (result) {
        console.log(result.body);
    })
    .catch(function (error) {
        console.error(error);
    });