Last active
May 26, 2016 11:28
-
-
Save r-k-b/e2a393397080fd6dbc677f06164a03f0 to your computer and use it in GitHub Desktop.
create links to cases from BC custom reports
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name create links to cases from BC custom reports | |
// @namespace https://gist.github.com/r-k-b/ | |
// @version 1.0.0 | |
// @description create links to cases from BC custom reports | |
// @author Robert K. Bell | |
// @homepage https://gist.github.com/r-k-b/e2a393397080fd6dbc677f06164a03f0 | |
// @downloadURL https://gist.github.com/r-k-b/e2a393397080fd6dbc677f06164a03f0/raw/create-links-to-cases-from-bc-custom-reports.user.js | |
// @include *://*/* | |
// @grant none | |
// @run-at context-menu | |
// ==/UserScript== | |
/* jshint esnext: true */ | |
(() => { | |
var rows = '.rgMasterTable tr'; | |
var link = (crmId, caseId) => `http://www.verto.org.au/CRM/CATS/CaseDetails_Detailsv2.aspx?EntityID=${ crmId }&EntityType=1001&CaseID=${ caseId }`; | |
// console.log('rows:', rows); | |
$(rows).each((index, row) => { | |
// console.log('row:', row); | |
let $caseId = $(row).find('td:nth-child(2)'); | |
let caseId = $caseId.html(); | |
let $crmId = $(row).find('td:nth-child(3)'); | |
let crmId = $crmId.html(); | |
// console.info(crmId, caseId); | |
let $link = $('<a/>') | |
.prop('href', link(crmId, caseId)) | |
.prop('target', '_blank') | |
.text(caseId); | |
try { | |
$($caseId).html($link); | |
// console.info('Replaced: ',$caseId) | |
} catch(e) { | |
console.warn(e); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment