We started with a web resource js that triggers on "New Task" button click on an Opportunity record. What we are trying to do now is take fields from the associated Opportunity record and populate Task Modal popup fields with them.
Here's the working js code to just open a new Task Modal popup:
function openmodalform() {
var pageInput = {
pageType: "entityrecord",
entityName: "task",
formType: 2,
};
var navigationOptions = {
target: 2,
width: {value: 500, unit:"px"},
position: 2
};
Xrm.Navigation.navigateTo(pageInput, navigationOptions);
}
And here's a visual of how we want fields to carry over automatically:

What we currently modified our js code to try to do this is the following. The fields on Opportunity do not carry over to the Task Modal popup.
function openmodalform() {
var pageInput = {
pageType: "entityrecord",
entityName: "task",
formType: 2,
};
var navigationOptions = {
target: 2,
width: {value: 500, unit:"px"},
position: 2
};
var opportunityId = Xrm.Page.data.entity.getId().replace(/[{}]/g, '');
var subject = Xrm.Page.getAttribute("dx_did_autoid").getValue();
var parameters = {};
parameters['reguardingobjectid'] = opportunityId;
parameters['parentcustomeridname'] = title;
parameters["subject"] = subject;
Xrm.Navigation.navigateTo(pageInput, navigationOptions,parameters);
}
Please let me know if you need any clarification.