Thursday, February 5, 2009

Hiding Locked Fields (and hiding tabs)

It's been well posted about hiding fields and tabs using javascript:
Hiding the 2nd tab can be done with js in the onload event:
crmForm.all.tab1Tab.style.display = 'none';

Hiding a field (must know the field ID):
crmForm.all.FIELDID.style.display = 'none';

I did a bunch of this for various reasons including getting fields to conditionally appear/disappear, hiding tabs that can't be removed for some reason (but are of no use to the implementation) and so forth.

At one point I needed the "Price Per Unit" field. It's locked on the form and the only way I could see to hide it was with javascript. The field hid well, but then I couldn't remove the "$". It was an element called "priceperunit_sys". I tried lots of things, then decided to move it to a new tab and simply hide the tab.

I realized this was a MUCH BETTER solution than hiding each field individually. In this way, I now have a "Hidden" tab that holds all the fields I don't want to display to my users. The advantage is that if I (or anyone else) needs to bring the fields back, they don't need to muck around in the code. They simply move them to a visible tab.

Of course...most fields can be removed, some you may just want hidden because they're used for calculations and may never be shown, but I just stumbled across this and wanted to share.

Attribute mapping - a newbie description

I read several blogs about "attribute mapping" (see credits below). The problem is that neither gave me (as being "new" to mappings) a good understanding of what was happening. I'll try and explain a little more. This was the info I needed:

When you promote an Opportunity Product to a Quote Line Item specific field values are mapped over. But what about custom Opportunity Product fields you might have created? They don't map out of the box. You need to do something - that falls under the 1:N relationship mappings.

Account to Opportunity is one that works out of the box. If you create a custom field on Account (call it "Platform") and on every Opportunity you create from that Account you want the value of "Platform" to be populated (default) with the "Platform" field of Opportunity. You need to go to the 1:N relationship on the Account entity. The one you use has the Primary entity of Account and the Related entity of Opportunity (In this case the name is "opportunity_primary_accounts"). Then you select the Mappings link along the left nav bar. Here you can add all the custom field mappings you want.

Okay, that's long, but all well and good. Back to my Opportunity-Product to Quote Line Item mapping. On the Opportunity Product entity 1:N relationships, there IS NO MAPPINGS link. But that's what I need...well, someone smarter than I figured out how to "find it". That's what the blogs below explain.

You'll need the GUID for the relationship and once you get your URL sorted out you'll get the mappings that you didn't have.

URL: http://yourservernamehere/Tools/SystemCustomization/Relationships/Mappings/mappingList.aspx?mappingId=

Sorry if this is long winded, but I read at least 2 blogs that had this solution and I couldn't understand that it was my solution (till I tried it).


Solution blogs I used should get credit. Both blog solutions I found give the explanation of the problem and similar (or the same) solutions:
http://www.techtalkz.com/microsoft-dynamics-crm/483211-crm-4-0-opportunity-product-quote-product-attribute-mapping.html

http://blogs.inetium.com/blogs/jmiley/archive/2008/09/27/map-custom-attributes-from-opportunity-product-to-quote-product-to-order-product-and-so-on-in-microsoft-crm-4-0.aspx

Tuesday, February 3, 2009

Resolution to workflows not publishing

CRM 4.0 rollup 2 seems to be the cause for workflows no longer publishing. So follow these steps to resolve the issue.
Find the CRM web.config file and make a copy/backup of it.
Open the web.config file and browse to the AuthorizedTypes section
Paste in the following text:

Save and close the web.config file. That is it. Microsoft mentioned they should have a KB artical about this soon.

-Laura