You need to sign in to do that
Don't have an account?
Custom Javascript Button that Run (Edits Record) on Behalf of Designated User?
I have a basic javascript button that when clicked updates a datefield on the opportunity object. I'd like to know if it's possible to edit the code in this button so that any user can click it and it will appear as if the record was updated by me, the system admin.
Here is the code:
I was thinking of designating the user as the system admin (using my user ID), but I couldn't get it working. Ultimately, I want it to work so that after the page refreshes, it shows the record as being last modified by myself and not the user who clicked the button.
Thanks in advance!
Here is the code:
{!REQUIRESCRIPT("/soap/ajax/38.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/38.0/apex.js")} var opp = new sforce.SObject("Opportunity"); opp.Id = '{!Opportunity.Id}'; opp.Dataloader_Update_Date__c = '{!Opportunity.Dataloader_Update_Date__c}'; opp.Manager_Followed_Opportunity__c = '{!Opportunity.Manager_Followed_Opportunity__c}'; // assign values to fields on opportunity object opp.Dataloader_Update_Date__c = new Date(); opp.Manager_Followed_Opportunity__c = true; //save the change result = sforce.connection.update([opp]); //refresh the page window.location.reload();
I was thinking of designating the user as the system admin (using my user ID), but I couldn't get it working. Ultimately, I want it to work so that after the page refreshes, it shows the record as being last modified by myself and not the user who clicked the button.
Thanks in advance!
Really hopeful that someone out there can help me with this request? Thanks again...!