Wednesday, August 26, 2015

MSCRM 2015: JS to Disable Custom Quote Number

In my previous two posts, I discussed how to create a custom quote number and use it with revisions. Now I'm going to provide a bit of JavaScript that you can use to lock the field. You'll want to do this so that users can't modify the field themselves.

1. Edit the Quote form and go to Form Properties.
2. On the Events tab, add a Form library or create new one. Then add the following script to the library. The part in quotes will be the name of your custom quote number.

function disableCustomQuoteNum(){
  var quoteNum = Xrm.Page.getAttribute("new_customquoteid").getValue();
  if (quoteNum != null) {
    Xrm.Page.ui.controls.get("new_customquoteid").setDisabled(true);
  }
}


3. Then add the function name, which is disableCustomQuoteNum, as an Event Handler.

4. Click OK then Save & Publish the changes to your form.

Now when we look at the quote, we can see that the Custom Quote ID field is locked.

BEFORE:

AFTER:



11 comments:

Олег Кієнко said...

http://topassignmentwriters.com/

I really had a great time with your post! I am looking forward to read more blog post regarding this! Well written!
http://topassignmentwriters.com/

Bogdan Yanov said...

Exquisitely professional thoughts. I merely hit upon this web site and desired to enunciate that I've definitely delighted in reckoning your blog articles or blog posts. Rest assured I'll subsist pledging to your RSS and I wish you write-up after much more shortly my profile

PLC training in chennai said...


WIZTECH Automation, Anna Nagar, Chennai, has earned reputation offering the best automation training in Chennai in the field of industrial automation. Flexible timings, hands-on-experience, 100% practical. The candidates are given enhanced job oriented practical training in all major brands of PLCs (AB, Keyence, ABB, GE-FANUC, OMRON, DELTA, SIEMENS, MITSUBISHI, SCHNEIDER, and MESSUNG)

PLC training in chennai
Automation training in chennai
Best plc training in chennai
PLC SCADA training in chennai
Process automation training in chennai
Final year eee projects in chennai
VLSI training in chennai

Mahesh Babu said...

Packers and Movers in Pune
Packers and Movers in Hyderabad
Packers and Movers in Bangalore

Mahesh Babu said...

Packers and Movers in Delhi
Packers and Movers in Gurgaon
Packers and Movers in Mumbai

Mahesh Babu said...

Packers and Movers in Noida
Packers and Movers in Chennai
Packers and Movers in Ghaziabad
Packers and Movers in Faridabad
Packers and Movers in Navi Mumbai
Packers and Movers in Thane

Mahesh Babu said...

Packers and Movers Hyderabad
Packers and Movers Pune
Packers and Movers Bangalore
Packers and Movers Mumbai
Packers and Movers Delhi
Packers and Movers Gurgaon

Verified5 said...

Packers and movers in delhi@
http://www.thepackersmoversdelhi.com

Kay Kay Menon said...

Thanks for sharing your great information please keep it up...
Best Packers and Movers Pune
Best Packers and Movers Mumbai
Best Packers and Movers Pune Blog
http://www.bestpackers.org/category/packers-and-movers-pune

Mohit Sharma said...

packers and movers in india@
https://quicksoluction.com/
packers and movers in delhi@
http://quicksoluction.com/packers-and-movers-in-delhi.html
packers and movers in mumbai@
http://quicksoluction.com/packers-and-movers-in-mumbai.html
packers and movers in pune@
http://quicksoluction.com/packers-and-movers-in-pune.html
packers amd movers in gurgaon@
http://quicksoluction.com/packers-and-movers-in-gurgaon.html

Anonymous said...

Packers Movers in Chandigarh
http://www.fastsoluction.com