function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Matt O'HaraMatt O'Hara 

Javascript Bookmarklet for field modification

Our org shares Contact and Account Objects across Users, and so we have locked down some things like a User's ability to deactivate a Contact. So they make these requests of the admin team, and we go in and deactivate the Contact. The issue is that there are a bunch of fields that need to be updated and it's a lot of clicks. I created a Javascript Custom Button to make easy work of this. The problem is that I don't want to create a new Page Layout just for the admin team to use this button.

I don't know enough about Javascript to A) know if this is possible via a bookmarklet and B) modify my code to make it work via a bookmarklet (I cobbled this together looking at other peoples' work). I know I need to change the double quotes to single, and maybe encode the URI. How do I include the library? Here is what I have currently:

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var c = new sforce.SObject("Contact");
c.id = "{!Contact.Id}";
c.Request_to_Change__c = null;
c.Reason_for_Inactivation__c = null;
c.Request_to_Change_Detail__c = null;
c.Active_Contact__c = "False";
c.Contact_status__c = "Inactive";
result = sforce.connection.update([c]);

window.location.reload();