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

How to add a Profile restriction to Javascript button

Good morning, 

I have an easy one for someone to answer (easy for a developer, not for me), 

I created a Javascript button to update the Status field on a Custom Object (Sales Order), but only want specific profiles to be able to click this button: the javascript for the button to update works fine, but I'm not sure how to add a line to make it execute only for specific profile(s):

var sor = new sforce.SObject("Sales_Order__c");

sor.Id = "{!Sales_Order__c.Id}";

sor.Status__c = "Sales Order Completion";
var result = sforce.connection.update([sor]);

Can somebody guide me on how to add a line to allow for only specific profiles (or to restrict certain profiles)
AmitAmit (Salesforce Developers) 

You will have to use different page layout with button and then assign those layouts to the profiles.

More information can be found at following link :

Amit Bhardwaj