Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How can I hide a field on a form in CRM 4.0 if a bit field is YES?

Posted on 2009-04-10
9
1,221 Views
Last Modified: 2013-11-24
I need to know how to hid a "Section" of the "Account" Entity Form is a bit field is set to "Yes"

This would need to be an "onChange" script for the bit field that will be used to toggle whether it the section is visible or not.
0
Comment
Question by:jgould763
  • 5
  • 4
9 Comments
 
LVL 10

Expert Comment

by:crm_info
ID: 24118100
To hide a section, you can use this code:
crmForm.all.<insert schema name here>. parentElement.parentElement.parentElement.style.display = 'none';
To unhide a section, you can use this code:
crmForm.all.<insert schema name here>. parentElement.parentElement.parentElement.style.display = 'block';
Where <insert schema name here> is the name of any field in the section that you want to hide.
So, assuming you have a bit field named "new_hidesection" and, within the section, you have a field named "new_nameofdog", then the code below should work for you.
 
Signature deleted
modus_operandi, EE Moderator

// Insert this into the OnChange for the new_hidesection field
 
if (crmForm.all.new_hidesection.DataValue) then
{
  crmForm.all.new_nameofdog. parentElement.parentElement.parentElement.style.display = 'none';
}
else
{
  crmForm.all.new_nameofdog. parentElement.parentElement.parentElement.style.display = 'block'; 
}

Open in new window

0
 

Author Comment

by:jgould763
ID: 24118154
I'm not sure what pieces of this code I need to change for my exact needs.
Can you help?
 
The "bit" field that is to be used to toggle the view/hide is called "new_usedefaults"
 
The section to hide if the box is check is the "Basys" Section on a tab called "New Account Setup"
 
Are you able to tweek the code for me?  I'm a java beginner at best.
0
 
LVL 10

Expert Comment

by:crm_info
ID: 24118188
Sure...can you give me the name of one field within the section that you want to hide?  Any field name will do.  I need the system name, not the display name (probably something like "new_fieldname").
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:jgould763
ID: 24118198
new_basysshipzone
0
 
LVL 10

Expert Comment

by:crm_info
ID: 24118272
The code below should work for you.
// Insert this into the OnChange for the new_usedefaults field
 
if (crmForm.all.new_usedefaults.DataValue)
{
crmForm.all.new_basysshipzone.parentElement.parentElement.parentElement.style.display = 'none';
}
else
{
crmForm.all.new_basysshipzone.parentElement.parentElement.parentElement.style.display = 'block'; 
}

Open in new window

0
 

Author Comment

by:jgould763
ID: 24118325
That didn't work.  Do we need to say that  
if (crmForm.all.new_usedefaults.DataValue)  
equals something, then hide else show?
 
Also, the defaul value for the field is Yes but now that this code is in place, it defaults to no.
I think we are on the right track here.


0
 

Author Comment

by:jgould763
ID: 24118334
Actually it does work, I just needed to click out of the field, however, I do still have the issue with the fied defualting to "no"
0
 
LVL 10

Accepted Solution

by:
crm_info earned 500 total points
ID: 24118358
The code should work (I set it up in our environment and it works as expected) - but a couple of items to note:
* If your bit field is a checkbox, then it won't hide / unhide the field until after you've tabbed off of it.  If you want it to change as soon as the user changes the value in the checkbox, it will take more code than I have time to work on at the moment ... but you could change it to a picklist instead.
* I'm not sure why the default would be changing.  Are you testing it on a record that may already have its value set?
* Make sure that, if you copied/pasted the code, that you did not introduce any new line breaks that may cause it to fail.
* Make sure that the capitalization  on the field names is exactly right - JavaScript is case sensitive.
0
 

Author Comment

by:jgould763
ID: 24118676
You nailed it!!
 
I was opening an existing account where the field was set to "No'
 
Thanks a ton!
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Salesforce.com’s Console is a great tool to view activities, leads, contacts, accounts and opportunities all in one screen. It is particularly effective during call blocks and working numerous activities at a time in a quick, repetitive fashion (suc…
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

790 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