Category Archives: JS Script

Show Associated View in IFrame MS CRM 4.0

Some time we need to show associated view (1:N or N:N) in Iframe. I found a good article in https://community.dynamics.com/blogs/crmjimwang/comments/28067.aspx written by Jim Wang. After doing some little changes it worked like a charm for me. You can use this code for any associated view (1:N or N:N). You just need to get Left navigation item name that you can… Read more »

Make left navigation link as default link in a record

I found a question here to set left navigation link as default for ms crm record, while opening ms crm form. http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/9dd557d3-3828-441b-a6dc-e6c481fdb8c9 We can easily do this through JS, we just need to get ID of particular left navigation item which we can get IE Dev toolbar or Developer Tools Paste this code on form onload event var NavItem=document.getElementById(“Paste LeftNavigation… Read more »

Calculate Number of Days between two Dates in MS CRM

Some time we need to calculate number of days between two dates in crm, we can easily do this using below JS script var d1=crmForm.all.FirstDate.DataValue; var d2=crmForm.all.SecondDate.DataValue; var DayValue=1000*60*60*24; alert(Math.ceil((d2.getTime()-d1.getTime())/DayValue)); Update for Dynamics 365 var d1=Xrm.Page.getAttribute(“FirstDate”).getValue(); var d2=Xrm.Page.getAttribute(“SecondDate”).getValue(); var DayValue=1000*60*60*24; alert(Math.ceil((d2.getTime()-d1.getTime())/DayValue));