• Peter Schultz
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
we have a limited number of licenses in our full sandbox for service cloud and are hesitant to refresh in any short period of time. I created a simple javascript that would just take away who ever was testing with the license but the update does not seem to work. it queries correctly, just doesnt update
 
{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")}
var ChangedUser = new sforce.SObject("User");
var CurrentUser = new sforce.SObject("User");

result = sforce.connection.query("select id,name from User where userpermissionssupportuser =true and isactive=true limit 1");
records = result.getArray("records");
if(records[0])
{
 for (var i=0; i< records.length; i++) {
    var record = records[i];
  if(confirm(record.Name +" has the license, do you really want to mess with them?")){
     ChangedUser.UserPermissionsSupportUser=false;
     ChangedUser.ID=record.id;
 try{    sforce.connection.update([ChangedUser]);
  }catch(er) {
alert(er);
}  
}
  }
}
window.location.reload();

Anyone have any thoughts on why that wouldn't update the user record?  I have the ability to manually update it.
We have a new community that we would like to breadcrumb as much as possible.   What I would like to do is track each user on each VF page load.

Right now i use the following apex but I am having trouble figuring a way to incorporate this into other pages with their own apex controllers. my understanding is that i could not put this into a component but  I am interested in any options that doesnt require an extension per page

I borrowed almost 100% of the code from
http://salesforce.stackexchange.com/questions/14754/tracking-visualforce-page-usage

public class TrackVF{

    public pageReference trackVisits(){
        VF_Tracking__c newTracking = new VF_Tracking__c(User__c=UserInfo.getUserId(),Page_Visited__c=URL.getCurrentRequestUrl().toExternalForm(),Datetime_Visited__c=datetime.now());
        insert newTracking;
        return null;
    }//END trackVisits

}//END class
we have a limited number of licenses in our full sandbox for service cloud and are hesitant to refresh in any short period of time. I created a simple javascript that would just take away who ever was testing with the license but the update does not seem to work. it queries correctly, just doesnt update
 
{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")}
var ChangedUser = new sforce.SObject("User");
var CurrentUser = new sforce.SObject("User");

result = sforce.connection.query("select id,name from User where userpermissionssupportuser =true and isactive=true limit 1");
records = result.getArray("records");
if(records[0])
{
 for (var i=0; i< records.length; i++) {
    var record = records[i];
  if(confirm(record.Name +" has the license, do you really want to mess with them?")){
     ChangedUser.UserPermissionsSupportUser=false;
     ChangedUser.ID=record.id;
 try{    sforce.connection.update([ChangedUser]);
  }catch(er) {
alert(er);
}  
}
  }
}
window.location.reload();

Anyone have any thoughts on why that wouldn't update the user record?  I have the ability to manually update it.
We have a new community that we would like to breadcrumb as much as possible.   What I would like to do is track each user on each VF page load.

Right now i use the following apex but I am having trouble figuring a way to incorporate this into other pages with their own apex controllers. my understanding is that i could not put this into a component but  I am interested in any options that doesnt require an extension per page

I borrowed almost 100% of the code from
http://salesforce.stackexchange.com/questions/14754/tracking-visualforce-page-usage

public class TrackVF{

    public pageReference trackVisits(){
        VF_Tracking__c newTracking = new VF_Tracking__c(User__c=UserInfo.getUserId(),Page_Visited__c=URL.getCurrentRequestUrl().toExternalForm(),Datetime_Visited__c=datetime.now());
        insert newTracking;
        return null;
    }//END trackVisits

}//END class

Has anyone created a simple connector to toggl time tracking?  For example, I would like to drop a button on a case "Track Time" and have it open a Toggl session with Project = Case #.

  • November 17, 2012
  • Like
  • 0