web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Need to update my modal dialog box with custom html web resource to be compatible with the UCI

(0) ShareShare
ReportReport
Posted on by 19

I have a button on a ribbon which runs a script to open a dialog box, in which the user can create recurring monthly records.
It no longer opens in the CRM UCI, and my understanding is that it is because the modal dialog method used was deprecated.

I am attempting to re-code it, but have not been successful.  See old code and new code below...

Old code:

//Open Modal dialog
function openModal() {
debugger;
var deadLineDate = Xrm.Page.getAttribute('xrm3_1stdeadlinedate');
if (deadLineDate == null || deadLineDate == undefined) {
alert("A required field was removed from the form. Contact your CRM administrator to review. -1stdeadlinedate");
return;
}
var dDate = deadLineDate.getValue();
if (dDate == null || dDate == undefined) {
alert("You must enter a deadline date.");
return;
}
var DialogOption = new Xrm.DialogOptions();
DialogOption.width = 315; DialogOption.height = 340;
var url = "/WebResources/xrm3_/htm/recurrence.htm";

Xrm.Internal.openDialog(Mscrm.CrmUri.create(url).toString(),
DialogOption,
null,
null,
CallbackFunction);

}
//modal windoow returned values
function CallbackFunction(returnValue){
debugger;
if(returnValue == null ) return;
if (returnValue.recurValue == null || returnValue.recurValue == undefined) return;
if (returnValue.recur == null || returnValue.recur == undefined) return;

Xrm.Page.getAttribute('xrm3_recurringfrequency').setValue(returnValue.recur);
Xrm.Page.getAttribute('xrm3_quantity').setValue(returnValue.recurValue);

createRecurring();

}

New code:

//Open Modal dialog
function openModal() {
debugger;
var deadLineDate = Xrm.Page.getAttribute('xrm3_1stdeadlinedate');
if (deadLineDate == null || deadLineDate == undefined) {
alert("A required field was removed from the form. Contact your CRM administrator to review. -1stdeadlinedate");
return;
}
var dDate = deadLineDate.getValue();
if (dDate == null || dDate == undefined) {
alert("You must enter a deadline date.");
return;
}

Xrm.Utility.openWebResource("xrm3_/htm/recurrence.htm",null,500,420);

var pageInput = {
pageType: "webresource",
webresourceName: "recurrence.htm"
}
var navigationOptions = {
target: 2,
width: 315, // value specified in pixel
height: 340, // value specified in pixel
position: 1
}
}

Xrm.Navigation.navigateTo(pageInput, navigationOptions).then(
function success(openModal) {
// Run code on success
},
function error() {
// Handle errors
}
);

}
//modal windoow returned values
function CallbackFunction(returnValue){
debugger;
//alert(returnValue);
if(returnValue == null ) return;
//if (returnValue.startDate == null || returnValue.startDate == undefined) return;
if (returnValue.recurValue == null || returnValue.recurValue == undefined) return;
if (returnValue.recur == null || returnValue.recur == undefined) return;

Xrm.Page.getAttribute('xrm3_recurringfrequency').setValue(returnValue.recur);
Xrm.Page.getAttribute('xrm3_quantity').setValue(returnValue.recurValue);
//Xrm.Page.getAttribute('xrm3_1stdeadlinedate').setValue(startDate);

createRecurring();

}

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    You will have to refactor your updated code in order to use navigateTo the proper way. I provided some additional information here - butenko.pro/.../

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Pallavi Phade Profile Picture

Pallavi Phade 102 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2026 Season 1

#3
ManoVerse Profile Picture

ManoVerse 45 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans