Hi All,
It will be helpful if you please help me with this small doubt. I want my CRM Form to show all fields to have a date which should be 10th day of month like 10/03/2018 in the field called due date. I am not able to write JS code, can anyone please help me.
*This post is locked for comments
Hi
You can try the following code plz change the schema name and write the js onChange event on form properties
function test()
{
var _ContractStartDate = Xrm.Page.getAttribute("new_contractstartdate").getValue();
if (Xrm.Page.getAttribute("new_contractstartdate") != null) {
var ContractStartDate = new Date(_ContractStartDate.getMonth() + 1 + "/10/" + _ContractStartDate.getFullYear())
Xrm.Page.getAttribute('new_contractstartdate').setValue(ContractStartDate);
}
else {
Xrm.Page.getAttribute('new_contractstartdate').setValue(null);
}
}
Thanks,
Ha ha...i new it will work. It is simple javascript basics.
You could read about it here more if you would like community.dynamics.com/.../javascript-basics
Do remember to close the thread by marking the suggestion as helpful.
I am so obliged. It worked like magic so many many thanks to you .. thanks a ton!!! You are great....
Thats fine...its a good sign. Trying refreshing a browser and see if this works.
Verify tge name you have used fixADate is same as you have in the javascript
After trying to fill the date field I get this error
sorry for bothering you...
Try adding it on load an see if it works. So if you add it on change tgen the code will execute when you change the value of that field.
Hope this helps
That is how it showed and in the form properties , I made the event handler as onSave
Can you share some screenshot. I am suspecting that you have added it as an onchange of field?
I had used the code in events of the required field "suc_paymentduedate" instead of "new_duedate and saved and published. Then reloaded my form to do the testing but my field PaymentDueDate is still blank :(
Coudl you please share the steps you have followed. It should either work as expected or throw some error.
How did you add this script on your form? Did you publish the changes?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156