locked
JavaScript to retrieve the value of "createdon" field when it is not placed on the form RRS feed

  • Question

  • Hi Folks,

      Can we write a javascript to get the value of "createdon" field of the record, provided the field is not placed on the form?

    Kind Regards,

    Rameshwari

    Wednesday, October 9, 2013 9:54 AM

All replies

  • Hi Ramesh,

    A simple solution is to add the field to form, make it read only and then hide it using Java script on 'OnLoad' event of Form. This way you use the field in your code and hide it at the same time. 

    Here is how you can hide a field in CRM 4.0:

    crmForm.all.createdon.style.display ="none";
    
    Or 
    
    crmForm.all.createdon_c.style.display = "none";
    crmForm.all.createdon_d.style.display = "none";

    And here is how you can do the same in CRM 2011

    Xrm.Page.ui.controls.get("createdon").setVisible(false);



    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful" Thanks, Imran Abbasi



    Wednesday, October 9, 2013 10:07 AM
  • Hi,

    You can retrieve the current record using Odata query. In such a case you will not have to put the field on form.

    HTH!

    Thanks!

    Wednesday, October 9, 2013 10:14 AM