Showing posts with label remove field on Form. Show all posts
Showing posts with label remove field on Form. Show all posts

Monday, July 13, 2009

Price List Lookup does not show up any Price Lists in Opportunity form

The Price List Lookup on the Opportunity form, displays the price lists for the currency selected on the Opportunity. If no price list has been created for the specified currency it would not show any price lists in the lookup.

In our case this was not the case. Here is what caused it…

We once happened to remove the Price List attribute from the Opportunity form as the customer was not going to use the Price Lists. We had plugns in place to set the Price List by default on the create event of the Opportunity.

But when we removed the Price List from the Form we got the following error

So we planned to put the field back on the form and explained to the customer that price lists would need to be provided on the form so you might as well select the appropriate price list manually from the form.

But what stunned us, is that after putting the field back on the form, the lookup no longer seems to work. It will always bring up an empty lookup window even though we have price lists created in the same currency as that of the Opportunity.



The Price List Lookup works on all other entities except this one as we had initially removed this attribute from the form and later added it back.

On further investigation we found that our adding the attribute back did not bring it to the same state as the original form provided by Microsoft. If you compare the customization file of the original Opportunity entity from MS with the one after you manually added the Price List attribute back… you would notice they are not the same. The original form has the following script that is missing when we added the attribute to the form

Script from our customized Opportunity entity:

<cell id="{2bf4485c-3d3e-444f-ac11-8a6262083d88}">
<labels>
<label description="Price List" languagecode="1033" />
</labels>
<events>
<event name="setadditionalparams" application="true" active="true">
<script><![CDATA[
var oLookup = event.srcElement;
AddTransactionCurrencyParam(oLookup);
]]></script>
<dependencies>
<dependency id="transactioncurrencyid" />
</dependencies>
</event>
</events>
<control id="pricelevelid" classid="{270BD3DB-D9AF-4782-9025-509E298DEC0A}" datafieldname="pricelevelid" />
</cell>

Script from our customized Opportunity entity:

<cell auto="false" showlabel="true" locklevel="0" rowspan="1" colspan="1" id="{2acdf564-bd2b-4392-9a93-52a133f856be}">
<labels>
<label description="Price List" languagecode="1033" />
<label description="Tarifs" languagecode="1036" />
<label description="Preisliste" languagecode="1031" />
<label description="Lista de precios" languagecode="3082" />
</labels>
<control id="pricelevelid" classid="{270BD3DB-D9AF-4782-9025-509E298DEC0A}" datafieldname="pricelevelid" disabled="false">
<<parameters>
<AutoResolve>true</AutoResolve>
</parameters>
</control>
</cell>

And this is the reason that the price list does not work after you add it back…

Resolution: Either populate this field through scripting by copying the customer pricelist to the Price List automatically(this does away with the need to lookup the price list) or replace the Original Opportunity customizations back from an unmodified CRM system.