Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

Auto-populated date field on page load

$
0
0

I am trying to auto-populate the date fields on page load event. 

I have the following code:

var today = new Date();

today = dd+'/'+mm+'/'+yyyy;  //today is in this format

 var dateCreated =    Xrm.Page.getAttribute("dateCreated").getValue();    //date only, read-only, business required

var dateTimeEntered =   Xrm.Page.getAttribute("dateTimeEntered").getValue();  //datetime

if(dateCreated == null)
{
      Xrm.Page.getAttribute("dateCreated").setValue(today); 

}

Issue: The value (today) is not set.

I tried Business rules, but date can not be calculated when the record has not yet been created

The workflow does not have anything to populate fields, before the record is created (only after).

The system "createdon" and "createdby" fields, don't auto-populated on load either, only on save.

I was able to populate custom "newcreatedby" with the code above, but dates are not being populated.

 

Thanks,

 


Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>