I want to track how often certain TABS are clicked by users within CRM365.
So let's say on the Account form there is a TAB called 'Adress' I want to know how often users click on that TAB.
It is not necessary to know which user has clicked how many times on that TAB but just how many times that TAB is clicked on by all users.
I was thinking on setting up an Entity called 'TAB logging'
And then have whole number fields like : 'Account_Adress' , 'Account_History' , 'Account_Information' , corresponding to the name of the TABS within t he account form.
Every time a TAB is openend / clicked on by a user then the number in e.g. field 'Account_Adress' on entity 'TAB logging' is +1 higher.
I found a Jscript (carldesouza.com/run-javascript-when-user-clicks-on-unified-interface-tab/) that responds to a user click on a TAB only now it shows an alert (that I don't want).
-----------------------------------------------------------------------------------
function OnLoad(executionContext) {
formContext = executionContext.getFormContext();
var PartnerDetailsTab = formContext.ui.tabs.get("Partner_Details");
PartnerDetailsTab.addTabStateChange(TabClicked);
}
function TabClicked() {
alert("Tab Clicked");
}
-------------------------------------------------------------------------------------
It would be great if somebody has a Jscript for this wish (or another solution).
The purpose of this TAB logging is to know how often a TAB is clicked on by users so that we can decide whether we want to invest more on certain data that is showed in that TAB or that we can remove the TAB because it is not used often enough.
Actually I think it's kind of weird that I cannot find anything on this kind of functionality.
To be sure: I know there is Auditing in System Settings but that is not what I mean, also not the 'Start read auditing' option which is way to intrusive.
Try something like this, I'm sure there is a slightly more efficient way to write this, but I had something kind of written up already that I just updated. Let me know if you get stuck, most of the ALLCAPS stuff is where you need to replace with schema.
function OnLoad(executionContext) {
formContext = executionContext.getFormContext();
var PartnerDetailsTab = formContext.ui.tabs.get("Partner_Details");
PartnerDetailsTab.addTabStateChange(TabClicked);
}
function TabClicked(executionContext) {
formContext = executionContext.getFormContext();
var recordtoUpdatesGUID = DEPENDSHOWYOUAREPASSINGINTHEID;
if(recordtoUpdatesGUID)
{
var guidOfNewTable = recordtoUpdatesGUID[0].id.slice(1, -1);
Xrm.WebApi.retrieveRecord("SCHEMANAMEOFNEWTABLE", guidOfNewTable, "?$select=INTFIELDSCHEMANAME").then(
function success(result){
var currentCount = result.INTFIELDSCHEMANAME;
var newCountFieldValue = currentCount + 1;
var data =
{
"INTFIELDSCHEMANAME": newCountFieldValue
}
Xrm.WebApi.updateRecord("SCHEMANAMEOFNEWTABLE", guidOfNewTable, data).then(
function success(result) {
console.log("record updated");
},
function (error) {
console.log(error.message);
// handle error conditions
}
);
},
function (error) {
//failed to find the record to update
console.log(error.message);
}
);
}
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,782 Super User 2024 Season 2
Martin Dráb 229,067 Most Valuable Professional
nmaenpaa 101,150