Difference between Xrm.Page.getControl(‘xyz’).getValue() and Xrm.Page.getAttribute(‘xyz’).getValue() in Dynamics 365 CRM

By | November 21, 2018

Many times while working in Dynamics 365 CRM we found small clues tips which sometimes becomes life saver for us. Today in this blog I will share one of such small tip.

If we enter special characters like # $ % & ( ‘ in text input the GetControl & Getattribute will give different result.


Xrm.Page.getControl(ikl_folderpath).getValue() returns /folderpath

Xrm.Page.getAttribute(ikl_folderpath).getValue() returns /folderpath#

Both the above statements return different results.

GetControl() method replaces the special characters # $ %  & ( ‘  to blank if it is placed at the end whereas GetAttribute() method doesn’t remove any special characters from the end and displays it as it is.

Hope this helps!


Leave a Reply

Your email address will not be published. Required fields are marked *