Skip to content

Instantly share code, notes, and snippets.

@codazoda
Created October 23, 2020 21:43
Show Gist options
  • Save codazoda/67d488bcbc320875a157df5d4d4d8a0d to your computer and use it in GitHub Desktop.
Save codazoda/67d488bcbc320875a157df5d4d4d8a0d to your computer and use it in GitHub Desktop.
let date = new Date();
let dateString = '';
let name = '';
let opportunityNameField;
dateString = date.getFullYear();
dateString += '-' + (date.getMonth() + 1);
dateString += '-' + date.getDate();
dateString += ' ' + date.getHours();
dateString += ':' + date.getMinutes();
dateString += ':' + date.getSeconds();
bookmarkletUser = localStorage.getItem("bookmarklet-user");
if (bookmarkletUser == null) {
bookmarkletUser = prompt("What name do you want to put in all your test orders?");
localStorage.setItem("bookmarklet-user", bookmarkletUser);
}
name = "TEST " + bookmarkletUser + " " + dateString;
// Set the opportunity name field
opportunityNameField = document.querySelector("#opp3");
opportunityNameField.value = name;
// Set the account name field
opportunityAccountField = document.querySelector("#opp4");
opportunityAccountField.value = "3 little monkeys";
// Set the close date field by clicking on the date
closeDateField = document.querySelector("span.dateInput:nth-child(2) > span:nth-child(2) > a:nth-child(1)");
closeDateField.click();
// Set the stage field
stageField = document.querySelector("#opp11");
stageField.value = "Closed Won";
// Set the type field
typeField = document.querySelector("#opp5");
typeField.value = "Existing Business";
// Set the lead source field
leadSourceField = document.querySelector("#opp6");
leadSourceField.value = "Current Client";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment