Extend Enable Field function

Dec 4, 2014 at 7:24 PM
Hi,

maybe it is the wrong place for suggestions, but I think it would be great, if the enableField function could be extended to an at least optional check for fieldsecurity, handled by a very simple function.
Like
function canFieldBeSet(fieldName) { return ((Xrm.Page.getAttribute(fieldName).getUserPrivilege().canUpdate && Xrm.Page.ui.getFormType == 2) || (Xrm.Page.getAttribute(fieldName).getUserPrivilege().canCreate && Xrm.Page.ui.getFormType == 1));}
In the enable field it could be checked if it is safe to enable the field, to avoid issues. The function could also be used to check before a value set to the field

I just had the need of it recently so I thought I share it here. Probably I am a duplicate or it is obsolete with CRM 2013 :). If so I apologize.

Best regards
Coordinator
Feb 8, 2015 at 5:43 PM
Hi There.

Thanks for the suggestion. Though a feel the example is a bit situational and normally you would not need to do such checking for a enable function in JavaScript.

Really appreciate the post though.

Kind Regards,
Jaimie