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
Irish@accIrish@acc 

Custom Button Not working for Profile other than system Admin

Below is the code which creates the related child object it works fine for sys admin but doesn't work for other profile

 

{!REQUIRESCRIPT("/soap/ajax/27.0/connection.js")}

{!REQUIRESCRIPT("/soap/ajax/27.0/apex.js")} var url = parent.location.href;

var prjid='{!Project__c.Id}';

var TaskId='{!Task__c.Id}';

result = sforce.connection.query("Select Status__c,Project__c from Task__c where Status__c not in ('Complete','Cancelled') and Project__c='"+prjid +"'");

 

var records = result.getArray("records");

var date = new Date('{!TODAY()}');

var i = records.length; if(i>0)  

  {     parent.location.href = url;  

   window.alert("All Tasks need to be completed before the project can be closed.");

}

else{

var createqod = new sforce.SObject("Quality_of_delivery__c");

createqod.Project__c = "{!Project__c.Id}";

createqod.Name = "{!Project__c.Name} ";

createqod.Approved_Status__c="Pending input from Dev Specialist";

createqod.Number_of_Change_Requests__c=0;

createqod.date__c=date; createqod.Final__c="True";

createqod.Dev_Lead__c="{!Project__c.Dev_Lead_UserId__c}"

sforce.connection.create([createqod]);

parent.location.href = url; window.alert("A final Quality of Delivery record has been created for the project. It needs to be updated and approved by Dev Lead - only then the project will be closed");

 

 

 

 

}

SabrentSabrent

May be permission issue. Check the user profile for required permissions.

imutsavimutsav
Check the profile of the users for create permission on the child Object and also check the field level security, may be any they don't have the access to any field which is not visible to them. Set the test user in debug log and see what error message you are getting.

Thanks
Utsav
JFraileJFraile

Hi

 

Try the following. Check API access checkbox for other users profiles

 

Cheers