Skip to content

Instantly share code, notes, and snippets.

@Quaker762
Created August 13, 2020 06:57
Show Gist options
  • Save Quaker762/5735572338556b70ab6072d1ed2cede9 to your computer and use it in GitHub Desktop.
Save Quaker762/5735572338556b70ab6072d1ed2cede9 to your computer and use it in GitHub Desktop.
var plan = db.PricingPlanSearch({}).records[2];
var newObj = {"name": "AdditionalIPv4Price","rows": [{"price": 0,"additionalIPv4": "none"},{"price": 10,"additionalIPv4": "1"},{"price": 20,"additionalIPv4": "2"},{"price": 40,"additionalIPv4": "4"},{"price": 80,"additionalIPv4": "8"},{"price": 160,"additionalIPv4": "16"}],"label": "IP Address","fields": [{"enum": [{"label": "None","value": "none"},{"label": "1","value": "1"},{"label": "2","value": "2"},{"label": "4","value": "4"},{"label": "8","value": "8"},{"label": "16","value": "16"}],"name": "additionalIPv4","label": "Additional IPv4","source": "input"},{"name": "price","label": "Price","source": "calculation"}]};
var data = JSON.parse(gjson.marshal(plan));
data.pricing.push(newObj);
data = JSON.stringify(gjson.marshal(plan));
db.PricingPlanSave(JSON.parse(data));
return plan;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment