@nathantegel with a little elbow grease on a form script, you can get this to go. Here is an example:
import {
connections,
integrations,
exports,
imports,
flows,
request
} from 'integrator-api';
class Form {
// { fieldMap: {}, layout: { fields: [] } }
constructor() {
this.fieldMap = {};
this.layout = {};
this.layout.containers = [];
}
fields(...fields) {
this.layout.fields = fields;
}
container(type, label, ...fields) {
this.layout.containers.push({
type: type,
containers: [{
label: label,
fields: fields
}]
});
}
column(label, ...fields) {
this.layout.type = 'column';
this.layout.containers.push({
label: label,
fields: fields
});
}
}
class Field {
constructor(id, name, label, type) {
this.id = id;
this.name = name;
this.label = label;
this.type = type;
}
isRequired() {
this.required = true;
}
removeInvalidValues() {
this.removeInvalidValues = true;
}
canBeDeleted() {
this.showDelete = true;
}
isMultiline() {
this.multiline = true;
}
description(description) {
this.description = description;
}
help(helpText) {
this.helpText = helpText;
}
typeOfInput(type) {
this.inputType = type;
}
default(defaultValue) {
this.defaultValue = defaultValue;
}
delimiter(delimiter) {
this.delimiter = delimiter;
}
keyNamePlaceholder(keyName) {
this.keyName = keyName;
}
valueNamePlaceholder(valueName) {
this.valueName = valueName;
}
mode(mode) {
this.mode = mode;
}
addOption(arg1, arg2, excludeItems) {
if (!excludeItems) {
if (!this.hasOwnProperty('options')) {
this.options = [{
items: []
}];
}
if (arg2) {
this.options[0].items.push({
label: arg1,
value: arg2
});
} else {
this.options[0].items.push(arg1);
}
} else {
if (!this.hasOwnProperty('options')) {
this.options = [];
}
if (arg2) {
this.options.push({
label: arg1,
value: arg2
});
} else {
this.options.push(arg1);
}
}
}
addStaticMapOptions(keyName, keyLabel, keyOptions, valueName, valueLabel, valueOptions) {
this.keyName = keyName;
this.keyLabel = keyLabel;
this.keyOptions = keyOptions;
this.valueName = valueName;
this.valueLabel = valueLabel;
this.valueOptions = valueOptions;
}
addStaticMapOptionsMap() {
this.optionsMap = [];
this.allowFailures = false;
this.hideLookupAllowFailures = true;
}
}
function formInit(options) {
let form = new Form();
// reference: https://docs.celigo.com/hc/en-us/articles/360059205112-Common-form-fields
// deconstruct form to make access to fieldMap for prop assignment simpler
let { fieldMap } = form;
//create field for staticMap with options map
fieldMap.multiMap = new Field('multiMap','multiMap', 'Multi mapping', 'staticMap');
fieldMap.multiMap.addStaticMapOptionsMap();
//gather netsuite locations
fieldMap.netsuiteLocation = new Field('netsuiteLocation','netsuiteLocation', 'NetSuite Location', 'select');
let nsLocations = getNetSuiteLocations();
for (let s of nsLocations) {
fieldMap.netsuiteLocation.addOption(s.label,s.value,true);
}
fieldMap.multiMap.optionsMap.push(fieldMap.netsuiteLocation);
//gather stages
fieldMap.customerStage = new Field('customerStage','customerStage', 'NetSuite Customer Stage', 'select');
for (let s of customerStageOptions) {
fieldMap.customerStage.addOption(s.label,s.value,true);
}
fieldMap.multiMap.optionsMap.push(fieldMap.customerStage);
//gather statuses
fieldMap.customerStatus = new Field('customerStatus','customerStatus', 'NetSuite Customer Status', 'select');
for (let s of customerStatusOptions) {
fieldMap.customerStatus.addOption(s.label,s.value,true);
}
fieldMap.multiMap.optionsMap.push(fieldMap.customerStatus);
//set the layout for the form
form.fields(...['multiMap']);
// wrap up by assigning form to options.resource.settingsForm prop; return the form as well
options.resource.settingsForm.form = form;
return form;
}
var customerStageOptions = [
{
"value": "lead",
"label": "Lead"
},
{
"value": "prospect",
"label": "Prospect"
},
{
"value": "customer",
"label": "Customer"
}
];
var customerStatusOptions = [
{
"value": "6",
"label": "Unqualified"
},
{
"value": "7",
"label": "Qualified Lead"
},
{
"value": "8",
"label": "In Discussion"
},
{
"value": "9",
"label": "Identified Decision Makers"
},
{
"value": "10",
"label": "Proposal"
},
{
"value": "11",
"label": "In Negotiation"
},
{
"value": "12",
"label": "Purchasing"
},
{
"value": "13",
"label": "Closed Won"
},
{
"value": "14",
"label": "Closed Lost"
},
{
"value": "15",
"label": "Renewal"
},
{
"value": "16",
"label": "Lost Customer"
},
{
"value": "17",
"label": "Qualified Prospect"
}
];
function getNetSuiteLocations() {
return exports.runVirtual({
"export": {
"name": "Lookup",
"_connectionId": "626c245268e40e1032975cfe",
"asynchronous": true,
"oneToMany": false,
"netsuite": {
"type": "restlet",
"skipGrouping": true,
"statsOnly": false,
"restlet": {
"recordType": "location",
"searchId": "3369",
"useSS2Restlets": false
},
"distributed": {
"useSS2Framework": false
}
},
"distributed": {
"disabled": false
},
"adaptorType": "NetSuiteExport"
}
}).data;
}