Skip to content

Instantly share code, notes, and snippets.

@dbrewitz
Last active June 7, 2017 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbrewitz/399a83605364b369caeb30bc2affb0f8 to your computer and use it in GitHub Desktop.
Save dbrewitz/399a83605364b369caeb30bc2affb0f8 to your computer and use it in GitHub Desktop.
Update statuses of Zoho Projects with JS
// These functions could be combined into one edit at a time.
// Set all Zoho projects from null to medium in custom "County Priority" field
function ZohoProjectStatusUpdate() {
var ele = document.querySelectorAll('.dropDownMenu .pointer[onclick*="ajaxShowPag"]')
for (var i = ele.length; i >= 0; i--) {
(function (index) {
setTimeout(function () {
ele[index].click()
changeItup(index)
}, i * 4500)
})(i)
}
function changeItup(i) {
setTimeout(function () {
var pub = document.querySelector('.w100per.h38.mT0[labelname="County Priority"]')
var sub = document.querySelector('#editprojdiv .buttonNew[value*="Update')
pub.getElementsByTagName('option')[2].selected = true
sub.click()
}, 2000)
}
}
ZohoProjectStatusUpdate()
// Set all Zoho projects from private to public for portal users (read only)
function ZohoProjectUpdate() {
var ele = document.querySelectorAll('.dropDownMenu .pointer[onclick*="ajaxShowPag"]')
for (var i = ele.length; i >= 0; i--) {
(function (index) {
setTimeout(function () {
ele[index].click()
changeIt(index)
}, i * 4500)
})(i)
}
function changeIt(i) {
setTimeout(function () {
var pub = document.querySelector('.pT15 input[value*="2"]')
var sub = document.querySelector('#editprojdiv .buttonNew[value*="Update')
pub.click()
sub.click()
}, 2000)
}
}
ZohoProjectUpdate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment