I’m trying to return an activity date to the account screen. The setValue function is actually deleting the value in the target field but not updating with the current date. The other test data I’m passing is working properly. No idea whats different.
//***** sample code to track last activity aging ******
activityage=function()
{
var last = window.top.opener.parent.Xrm.Page.data.entity.attributes.get("new_last_activity_date").getValue("new_last_activity_date");
// this line calls the values of a date field at the parent level during onopen of an activity form. This works (you can see the returned value in the alert two line down)
var state= 3;
//loads a test variable so I can see the Window.Top…write function work for another field on the account level.
alert(last)
var newest = new Date();
window.top.opener.parent.Xrm.Page.data.entity.attributes.get("new_last_activity_date").setValue(newest);
//this SHOULD write the date from “newest” in the target field on the account level but all it does is blank it out
alert(newest)
//displays today even though the line above is returning null
window.top.opener.parent.Xrm.Page.data.entity.attributes.get("new_last_activity_date").setSubmitMode("always");
window.top.opener.parent.Xrm.Page.data.entity.attributes.get("accountratingcode").setValue(state);
//this line DOES correctly write the content of “state” back into the other field on the same account form
}
I looked on line but can’t see anything different between writing a number vs a date in the window.top.opener.parent function. Any ideas???