How can Extr@mation help you?
Find out how we can help your business.
1st May 2024
Dynamics CRM to GP or NAV Integration.
Read More >
28th February 2024
Find out about our support contracts for our business clients.
Read More >
14th APRIL 2024
Integrate to Great Plains (GP) , Navision (NAV) or any data source including your own website!
Read More >
16th APRIL 2024
Migrate to or from Great Plains (GP) , Navision (NAV) or any data source using the Scribe adapters.
Read More >
3rd December 2024
This example demonstrates how to use JavaScript in Microsoft Dynamics CRM to
hide a tab or lock form fields, based on the value of a picklist.
We'll use the JavaScript "OnLoad" and "OnSave" functions that are accessible in the
Microsoft Dynamics CRM GUI.
The screenshot below depicts the CRM Account entity. The tab labelled "Hide Me" circled in red
will be made invisible when we change the "Relationship Type" of the customer to either "Competitor"
or "Consultant".
First of all we need to ensure that the tab we want to hide has the correct state when the
CRM form is loaded. This is where the Javascript "OnLoad" function comes in to play.
We do this by opening CRM, then clicking "Settings". From there we click "Customisation" and select
the "Account" entity. We want to modify the default form so double clicking "Form" from the list opens the screen
that we will customise.
In the "Commom Tasks" section to the right hand side, click "Form Properties", then on the "Events" tab
ensure that "OnLoad" is selected and then click "Edit".
A screen like the one below will open.
Ensure that the "Event is Enabled" checkbox is checked and then cut and paste insert the following code
into the text box:
The code above checks that the "customertypecode" (Relationship Type) field is equal to "Competitor"
OR "Consultant"
and if so, it hides the tab called "tab4Tab" by giving it a display equal to none when the form loads.
That's great I hear you say, but what if I want to hide the tab or lock form fields
when I change the value of the Relationship Type? What if I change the value to one where the tab should
not be hidden?
Well, read on because we will do just that!
Take a look at the screenshot below. Note that the "Relationship Type" has changed to
Competitor, and the tab labelled "Hide Me" no longer appears in the red highlighted circle.
We changed the Relationship Type to Competitor and nothing happened until we hit "Save and Close"
and then re-opened the account in question. It was only at that point that the "Hide Me" tab was hidden.
Really what we want is for the tab to hide as soon we change the Relationship Type.
To achieve this we open CRM, click "Settings" , "Customisation" and select
"Form" from list in the "Account" entity.
Double click the "Relationship Type" field, then click "Edit" on the "Events" tab. Note that
only the "OnChange" function is available.
As before, the following screen will open.
Cut and Paste the following code into your "Events" text area, ensuring that "Event is enabled" is checked and save.
The code above starts off the same as the previous example, up until the "else" clause.
This is what it does:
IF
the customertypecode field is equal to "Competitor" OR
"Consultant",
THEN
set "tab4Tab" to be hidden
ELSE IF
the customertypecode field is equal to "Investor",
THEN
set "tab4Tab" to be visible
AND
For Each form field in the tab, LOCK the field
ELSE (If the customertypecode does not equal "Competitor", "Consultant"
or "Investor)
Set the tab4Tab to be visible,
AND
For Each form field on the tab, UNLOCK
the field
Microsoft Dynamics CRM numbers each of the elements on a tab starting sequentially up from from zero.
Therefore, we create the "for loop" to start counting up from zero to the maximum number of objects on the
form, keeping the count (in the "i" variable) in memory. We then simply apply the number in the "i" variable
to the element's number and disable or enable the form field as appropriate.
Selecting a Relationship type of "other" will now enable the form fields on the "Hide Me" tab, as shown
in the screenshot below..
..and setting the Relationship type to "Investor" disalbes the fields as in the image below:
Extr@mation Limited provide consultancy, data integration and migration services using Scribe Insight.
Do you need to connect your website to your CRM system?
What about integrating your CRM with your ERP tool in real time?
We can help with all your migration and integration needs even if you have an existing integration that needs attention.
Why not Contact us to find out how we can help your business?
view Microsoft Dynamics, CRM, ERP, NAV, GP and Scribe Insight contracts here
view Scribe Insight contracts here
30th March 2010
We are a small consultancy services company predominantly offering B to B consultancy across a broad spectrum of IT aspects
We consider any length of contract from one day upwards, particularly in the arena of Data Migration or Integration, Web development, support, consultancy or project management.
Our offices are equipped for telecommuting and we make full use of all available technology to enable us carry out our business as effective as possible.
We have recently finished a project at the European Space Agency ( ESA ) in the space science department at ESTEC (Noordwijk), developing a document management system that interfaces directly into the Opentext LiveLink API.
More recently we have undertaken projects for the Capgemini, Cirquent, MoneySupermarket.com, Solution1 (Siemens), Atos Origin, Technology Innovation Centre, Solihull Metropolitan Borough Council, and Cadbury Schweppes and Cadbury Trebor Bassett.
Key skills in the development area are:
Our programming for the web encompasses:
ASP, VBScript, ASP .NET, VB.NET, CSS, XML, XSL, (D)HTML, SQL, JavaScript, plus several others.
We specialise with custom programming, credit card interfacing such as PayPal, MailForms, and connectivity to other systems - infact anything is considered.
We have undertaken specialist works such as Microsoft Access programming with Barcode entry systems, CRM systems, SAGE connectivity, emailing from Microsoft Office etc.
We can even supply training guides, either interactive or text book based.
Currently working on http://www.papermillcards.com, http://www.papermillcards.co.uk, http://www.papermillcrafts.com, http://www.papermillcrafts.co.uk, http://www.papermilldesign.com, http://www.papermilldesign.co.uk, http://www.craftish.com, http://www.craftish.co.uk , www.extramation.com
http://www.businessintelligencedeveloper.com and http://www.businessintelligencedeveloper.co.uk
Please take a look at our portfolio, and if you want to receive a CV, please contact us on the details below detailing your requirements.
consultant, contractor, freelance, web design, web developer, freelancer, project manager, e consultancy excellent rates, daily or hourly.based Nationally as well as in or around sutton coldfield, birmingham, lichfield, staffs.
business intelligence consultancy and developers specialising in BI SSRS ETL DTS SSIS SQL SERVER 2005 as well as custom ORACLE reporting and datawarehousing. Contact us for more information.
http://www.dynamicsintegration.com