[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2008-11-19
5
Medium Priority
?
2,268 Views
Last Modified: 2012-05-05
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>


0
Comment
Question by:MarkyMark_net
  • 2
  • 2
5 Comments
 
LVL 15

Expert Comment

by:WilyGuy
ID: 23013333
If you turn on Dev Errors, what is the error when you close the opportunity window?
0
 
LVL 15

Expert Comment

by:WilyGuy
ID: 23013348
Are there any OnLoad events for the form, or OnChange events for any of the fields?
0
 
LVL 1

Accepted Solution

by:
Brett_Rattey earned 1000 total points
ID: 23032682

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
 
LVL 1

Expert Comment

by:Brett_Rattey
ID: 23032700
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
 

Author Comment

by:MarkyMark_net
ID: 23038648
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

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

Automatically creating a Trello card using data from a Microsoft Dynamics CRM record turned out to be an easy project that yielded great results.  Here's how I did this for an internal team at General Code.
Desired Skill Set for Microsoft Dynamics CRM Technical Resources – Part III
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month17 days, 16 hours left to enroll

831 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