Dynamic Values in CRM Dialog Javascript

Within CRM there have been many times while using javascript that I have needed to interact with the user in small ways. For this, I have found that alertDialog and confirmDialog are very useful. Obviously, the interaction is nothing more than an acknowledgment and a yes/no response respectively, but it changes the experience from only interacting with the page which can be helpful. Most of the time I have just used a hard-coded value in the message on my dialogs, such as “Do you want to use the value from field X for field Y?” Recently, I wanted to see if I could change it up to include the actual value within the message to make it easier for the user to make an informed decision.

I never found anything explicitly showing the ability to add a dynamic value/variable in the message, so I had to try it out for myself. It is simple enough in that the message is just a string and as long as you have your variable passed as a string they can be concatenated.

function billStateCode() {

var billStateValue = Xrm.Page.getAttribute(“billstate”).getValue();

if (billStateValue != null) {

Xrm.Utility.confirmDialog(

‘Would you like to use the state “‘ + billStateValue + ‘” from the billing address for the shipping address?’,

function () {

//action when confirmed

},

function () {

//action when canceled

}

);

}

}

 

Want to learn more about Dynamics Values within CRM? Contact our consultants at info@ktlsolutions.com or by calling 301.360.0001.


[avatar user=”sflorance” size=”thumbnail” align=”left” /]SCOTT FLORANCE | Business Software Consultant

Scott Florance is one of the CRM Consultants at KTL, and has proven his value as a member of the team since September 2013. Whether implementing a new CRM organization or adding to existing configurations, Scott has engaged clients with a positive and enthusiastic demeanor to help them meet their organizational needs. With six plus years of experience, Scott is familiar with CRM as both a power user and administrator. Scott received his Bachelor’s Degree in Business Administration from the University of Central Florida. He is a Microsoft Certified Technology Specialist for Dynamics CRM, as well as a Certified Scribe Technician.

Share this post

Related Posts

Checking Your CMMC Progress

Written by Alec Toloczko With Cybersecurity Maturity Model Certification (CMMC) requirements on the horizon, it’s crucial for organizations handling Controlled Unclassified Information (CUI) to adhere

Read More »