[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Show/Hide Fields based on a Option field - Dynamics CRM

Posted on 2014-08-13
12
Medium Priority
?
436 Views
Last Modified: 2014-08-21
Hi I am trying to Show/Hide a Field based on the another field that is a two option field. Seems that when the Accounts form loads it correctly hides the field but when i select option "Yes" the hidden field does not reappear.

Sample code given below

function onCreditLimitChange()
{
var creditlimit = Xrm.Page.ui.controls.get("dot_whetherlimitbasedapproval");
if ( creditlimit = false ) {
Xrm.Page.ui.controls.get("dot_limitamount").setVisible(true);
}
else {
Xrm.Page.ui.controls.get("dot_limitamount").setVisible(false);
}
}

Please help.
0
Comment
Question by:GulfIT
  • 6
  • 5
11 Comments
 
LVL 20

Accepted Solution

by:
Rikin Shah earned 2000 total points
ID: 40258077
Hi,

Please change your function to below one:

function onCreditLimitChange()
{
var creditlimit = Xrm.Page.getAttribute("dot_whetherlimitbasedapproval").getValue();
if ( creditlimit == false ) {
Xrm.Page.ui.controls.get("dot_limitamount").setVisible(true);
}
else {
Xrm.Page.ui.controls.get("dot_limitamount").setVisible(false);
}
}

Open in new window

0
 

Author Comment

by:GulfIT
ID: 40259907
Thanks Rikin,

One more help. How do i make the dot_limitamount blank or null when the option is set to false.
0
 
LVL 20

Expert Comment

by:Rikin Shah
ID: 40260057
Hi,

Can you tell me if dot_limitamount is an OptionSet or Two Options?
If it is Two Options then you will not be able to make it null... It should be either True or False.
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 

Author Comment

by:GulfIT
ID: 40260065
its a Currency field.
0
 
LVL 20

Expert Comment

by:Rikin Shah
ID: 40260196
You can set it to 0.00 or 0 only.
0
 

Author Comment

by:GulfIT
ID: 40260426
Whats the code i need to add for this to make it blank ?
0
 
LVL 20

Expert Comment

by:Rikin Shah
ID: 40260493
Xrm.Page.getAttribute("dot_limitamount").setValue(null);

or

Xrm.Page.getAttribute("dot_limitamount").setValue(0);
0
 

Author Closing Comment

by:GulfIT
ID: 40265782
Done.
0
 
LVL 20

Expert Comment

by:Rikin Shah
ID: 40265995
Hi,

Is there any reason to mark the answer and accepting the solution as B? Is there anything missing in my answer?

In my knowledge I have provided perfect answer and I am eligible for all points.
0
 

Author Comment

by:GulfIT
ID: 40267013
Ohhh sorry i did not mean to do that. Is there anyway i can correct this?
0
 
LVL 20

Expert Comment

by:Rikin Shah
ID: 40267030
You can Click on Request Attention button and raise a request to moderator. He will handle the things.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
Desired Skill Set for Microsoft Dynamics CRM Technical Resources – Part I
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question