0

I have a javascript button, which is used to get the field value, that field is not added to page layout. This button is working fine for system admin but for, custom profile its not working Javascript Code:

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

if('{!Order.Field__c}' != null){ 
window.parent.location.href=('/{!Order.Field__c}'); 
} 
else{ 
alert("Okay"); 
}

Thanks

7
  • have you checked FLS?
    – Himanshu
    Commented Feb 18, 2016 at 19:04
  • Yes, and this field is editable to progiles Commented Feb 18, 2016 at 19:08
  • does this custom profile have atleast read access to the order object, is there an error when you click the button?
    – Rao
    Commented Feb 18, 2016 at 19:13
  • it seems only permission issue either on object or field.
    – Himanshu
    Commented Feb 18, 2016 at 19:14
  • Yes custom profiles have read access, i am sure this is not access issue as this is working fine when field is added to page layout Commented Feb 18, 2016 at 19:17

1 Answer 1

1

You can't directly access field in this way because if field is not in layout salesforce does not store its value.

So now you have three options.

  1. Add field on page layout and then refer here.

  2. Query the field using sforce here and then check the value.

  3. Or call an external webservice(Apex class) and then do the processing there.

I suggest go with option 1 or 2.

1
  • Resolve this problem by writing webservice class then calling it from javascript button. Commented Feb 25, 2016 at 19:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .