Cannot add 'New Opportunity Product' to an Opportunity in Microsoft CRM 4

In Microsoft CRM 4, when I open an Opportunity, goto 'Products' and click on 'New Opportunity Product' I get 'Error on page' showing up in the bottom status area of my browser.

Products will not add to the opportunity and when I close the opportunity window an error dialog window pops up and tells me that CRM has encountered an error.

I have sent the error off to Microsoft and got no response, when I view the data sent to Microsoft I see this:

Microsoft Dynamics CRM Error Report Contents

<CrmScriptErrorReport>
  <ReportVersion>1.0</ReportVersion>
  <ScriptErrorDetails>
      <Message>&#39;crmForm.pricelevelid.DataValue&#39; is null or not an object</Message>
      <Line>67</Line>
      <URL>/ReactiveMedia&#47;sfa&#47;opps&#47;edit.aspx&#63;id&#61;&#123;D50A09D2-95B3-DD11-AB3B-0019B9DD22FE&#125;</URL>
      <PageURL>/ReactiveMedia&#47;sfa&#47;opps&#47;edit.aspx&#63;id&#61;&#123;D50A09D2-95B3-DD11-AB3B-0019B9DD22FE&#125;&#35;</PageURL>
      <Function>locCustomAddRelatedToNonForm&#40;iTypeToAdd, createFromType, createFromId, additionalAttributes&#41;</Function>
      <CallStack>
        <Function>locCustomAddRelatedToNonForm&#40;iTypeToAdd, createFromType, createFromId, additionalAttributes&#41;</Function>
      </CallStack>
  </ScriptErrorDetails>
  <ClientInformation>
      <BrowserUserAgent>Mozilla&#47;4.0 &#40;compatible&#59; MSIE 7.0&#59; Windows NT 6.0&#59; SLCC1&#59; .NET CLR 2.0.50727&#59; Media Center PC 5.0&#59; .NET CLR 3.0.04506&#41;</BrowserUserAgent>
      <BrowserLanguage>en-us</BrowserLanguage>
      <SystemLanguage>en-au</SystemLanguage>
      <UserLanguage>en-au</UserLanguage>
      <ScreenResolution>1280x800</ScreenResolution>
      <ClientName>Web</ClientName>
  </ClientInformation>
  <ServerInformation>
    <OrgLanguage>1033</OrgLanguage>
    <OrgCulture>3081</OrgCulture>
    <UserLanguage>1033</UserLanguage>
    <UserCulture>1033</UserCulture>
    <OrgID>&#123;50640F2F-87AA-4703-A6CB-B9CCDB26AD11&#125;</OrgID>
    <UserID>&#123;D7D30B55-5D9C-DA11-85C9-0013208EF692&#125;</UserID>
    <CRMVersion>4.0.7333.3</CRMVersion>
  </ServerInformation>
</CrmScriptErrorReport>

<CrmScriptErrorReport>
  <ReportVersion>1.0</ReportVersion>
  <ScriptErrorDetails>
      <Message>Could not complete the operation due to error 80020101.</Message>
      <Line>220</Line>
      <URL>/ReactiveMedia&#47;sfa&#47;opps&#47;areas.aspx&#63;oId&#61;&#37;7bD50A09D2-95B3-DD11-AB3B-0019B9DD22FE&#37;7d&#38;oType&#61;3&#38;security&#61;852023&#38;tabSet&#61;areaProducts</URL>
      <PageURL>/ReactiveMedia&#47;sfa&#47;opps&#47;areas.aspx&#63;oId&#61;&#37;7bD50A09D2-95B3-DD11-AB3B-0019B9DD22FE&#37;7d&#38;oType&#61;3&#38;security&#61;852023&#38;tabSet&#61;areaProducts</PageURL>
      <Function>function anonymous&#40;&#41;&#10;&#123;&#10;window.execScript&#40;action&#41;&#10;&#125;</Function>
      <CallStack>
        <Function>function anonymous&#40;&#41;&#10;&#123;&#10;window.execScript&#40;action&#41;&#10;&#125;</Function>
      </CallStack>
  </ScriptErrorDetails>
  <ClientInformation>
      <BrowserUserAgent>Mozilla&#47;4.0 &#40;compatible&#59; MSIE 7.0&#59; Windows NT 6.0&#59; SLCC1&#59; .NET CLR 2.0.50727&#59; Media Center PC 5.0&#59; .NET CLR 3.0.04506&#41;</BrowserUserAgent>
      <BrowserLanguage>en-us</BrowserLanguage>
      <SystemLanguage>en-au</SystemLanguage>
      <UserLanguage>en-au</UserLanguage>
      <ScreenResolution>1280x800</ScreenResolution>
      <ClientName>Web</ClientName>
  </ClientInformation>
  <ServerInformation>
    <OrgLanguage>1033</OrgLanguage>
    <OrgCulture>3081</OrgCulture>
    <UserLanguage>1033</UserLanguage>
    <UserCulture>1033</UserCulture>
    <OrgID>&#123;50640F2F-87AA-4703-A6CB-B9CCDB26AD11&#125;</OrgID>
    <UserID>&#123;D7D30B55-5D9C-DA11-85C9-0013208EF692&#125;</UserID>
    <CRMVersion>4.0.7333.3</CRMVersion>
  </ServerInformation>
</CrmScriptErrorReport>


MarkyMark_netAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

WilyGuyCommented:
If you turn on Dev Errors, what is the error when you close the opportunity window?
0
WilyGuyCommented:
Are there any OnLoad events for the form, or OnChange events for any of the fields?
0
Brett_RatteyCommented:

Problem seems to be that the opportunityproduct is trying to save before you have entered a pricelist.

The pricelist filed has a script that when you remove the field from the form is removed.. so even if you put the field back on the form the script doesnt come back..

good news is there is a solution...
http://dmcrm.blogspot.com/2008_03_01_archive.html

if this is not the cause:
then  check:

that you dont have any Jscript on your opportunityproduct onload event to save the form.

crmForm.Save();

If you do for some reason need to save the opportunityproduct form onload... you can set the pricelist to a default price list  before you call the save function..

if ((crmForm.all.pricelevelid != null) &&(crmForm.all.pricelevelid.DataValue == null))
{
var priceList = crmForm.all.pricelevelid;
var Items = new Array();
Items[0] = newLookupControlItem("<insert Guid for your default pricelist>",1022, "Standard");
priceList.DataValue = Items;
}

if that is not the issue.
check:
if you have any plugins registered for either entities. buggy plugins can sometimes cause these error..





0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Brett_RatteyCommented:
sorry pricelist is on opportunity not opportunityproduct ignore the second scenario..(not on a network with a crm installation at the moment  so couldnt check :S) ...  although you could still use the jscript to set the pricelist on the opportunity onload or onsave event.
0
MarkyMark_netAuthor Commented:
I found that there were two issues with my setup.

Firstly, someone had removed the Price List field from the Opportunity form. I put the Price List field back on the form, unfortunately, the code that checked the Price List field had been filled in correctly has also been removed, which is why here was an Error on page message.

With the help of this http://dmcrm.blogspot.com/2008/03/removing-price-list-field-from.html I was able to export the Opportunity entity, add the code back in and re-import the customisation.

Although this didn't allow me to add a product, now when I added a product, an alert would now pop up and let me know that the Price List needed to be set (even though it had).

I was also getting help from Microsoft, they then suggested that I turned off the OnLoad scrpt for the Opportunity form and try adding a Product.

This worked, so I then turned the OnLoad script back on, removed all the If statements from the script and started adding them one at a time to find out which one was causing the problem. After adding all the If statements, I was not able to re-create the problem.

It's working now.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Dynamics

From novice to tech pro — start learning today.