Link to home
Start Free TrialLog in
Avatar of Asif Faleel
Asif FaleelFlag for United Arab Emirates

asked on

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

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.
ASKER CERTIFIED SOLUTION
Avatar of Rikin Shah
Rikin Shah
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Asif Faleel

ASKER

Thanks Rikin,

One more help. How do i make the dot_limitamount blank or null when the option is set to false.
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.
its a Currency field.
You can set it to 0.00 or 0 only.
Whats the code i need to add for this to make it blank ?
Xrm.Page.getAttribute("dot_limitamount").setValue(null);

or

Xrm.Page.getAttribute("dot_limitamount").setValue(0);
Done.
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.
Ohhh sorry i did not mean to do that. Is there anyway i can correct this?
You can Click on Request Attention button and raise a request to moderator. He will handle the things.