• Robert Pierce
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Greetings...

I have had great success in using .net and the associated API Enterprise generated WSDL and Web Reference for about a year.  I've also used the API in the Sandbox.  I hadn't made a change to the Sandbox or the Production for a couple of months.  Today I did the following in Firefox (I have had more success generating and downloading the WSDL in Firefox)

- Went to Settings/Develop/API/Generate Enterprise WSDL and clicked the GENERATE button to the right of "Generate Enterprise WSDL"
- The result in Firefox was not the normal formatted XML that I had seen in the past (perhaps the update to Firefox did this) What appeared was what looked like one big paragraph of sentences (no xml tags)
-  I right clicked in the white area of the page and "saved as"  test.wsdl
- When I opened test.wsdl, it looked like it alwas does...properly formed XML

Next in VS, I changed the Web Reference property to the Test.wsdl file name and Updated my Web Reference

======================================
Now the issue (finaly)
======================================

When I try to create an instance of SforceService like the code below:

                    SforceService sfService = new SforceService();

I get the following exception:

2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.Name InvalidOperationException
2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.Message Unable to generate a temporary class (result=1).
2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.Message error CS0030: Cannot convert type 'Mozenda.Business.Salesforce.ListViewRecordColumn[]' to 'Mozenda.Business.Salesforce.ListViewRecordColumn'
2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.Message error CS0030: Cannot convert type 'Mozenda.Business.Salesforce.ListViewRecordColumn[]' to 'Mozenda.Business.Salesforce.ListViewRecordColumn'
2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.Message error CS0029: Cannot implicitly convert type 'Mozenda.Business.Salesforce.ListViewRecordColumn' to 'Mozenda.Business.Salesforce.ListViewRecordColumn[]'
2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.Message error CS0029: Cannot implicitly convert type 'Mozenda.Business.Salesforce.ListViewRecordColumn' to 'Mozenda.Business.Salesforce.ListViewRecordColumn[]'
2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.Source System.Xml
2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.StackTrace at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.StackTrace    at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.StackTrace    at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.StackTrace    at System.Xml.Serialization.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type)
2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.StackTrace    at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)
2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.StackTrace    at System.Web.Services.Protocols.SoapClientType..ctor(Type type)
2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.StackTrace    at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()
2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.StackTrace    at Mozenda.Business.Salesforce.SforceService..ctor()
2014-09-11 16:35:30.000  Warning SalesforceClient.Connect Exception.Exception.StackTrace    at Mozenda.Business.SalesforceClient.SalesForceClient.Connect()


There is alot if information about "Unable to generate a temporary class (result=1)" doing a Google search, but nothing seems to apply.

- Has Salesforce changed how the Enterprise WSDL is created?

Thanks in advance!!

Russ






Hi everybody,

I have a problem with updating Opportunity Products. User can change the Discount, the Quantity and the Sales Price (in special cases only). The Total Price shall be calculated by the system and displayed at the VF page. In some cases Discount can be set to 100%. If so, I detected the issue that  the Sales Price (OpportunityLineItem.UnitPrice, so I call it UnitPrice in the following description) is set to null by the system during the Update.

In Forum Threads and in the Documentation of the OpportunityLineItem Object I read that UnitPrice and TotalPrice must not be set both during an Update. That’s why I force the TotalPrice to be null before I update a record which is selected from the database before. Indead, this solves the problem. The UnitPrice is stored into the database as expected and TotalPrice is calculated to 0.0 which is correct. Unfortunately the next update in exactly the same manner is failing. I get an exception that the TotalPrice must not be null…

 

I narrowed down the behavior with a simple test class in a developer edition. There are no custom fields, no triggers and no validation rules for the object OpportunityLineItem.

 

Here is the code of my test class mixed with the corresponding Debug information picked out from Apex Test Runner window in the IDE (Eclipse).

 

    static testMethod void myUnitTest() {
        // insert a dummy Product with PricebookEntries then check that they were created
        Product2 pr1 = new Product2(Name='Unit Test Product PR1 Dummy');
        insert pr1;
 
 	//Get the PriceBook
 	PriceBook2 pb=[Select Name, IsStandard, IsActive, Id From Pricebook2 Where IsStandard=true Limit 1];
 	PricebookEntry pe1 = New PriceBookEntry(Product2Id=pr1.Id,PriceBook2Id=pb.Id,unitPrice=444.0,isactive=true);
 	insert pe1; 
        
     
        Account ac1 = new Account(Name='Unit Test Parent');
        insert ac1;
        
        Opportunity op1 = new Opportunity(Name = 'Unit Test Parent', StageName='Prospecting', 
        CloseDate=System.today().addDays(1), AccountId=ac1.Id);
        insert op1;
        Opportunity op1s = [SELECT ID FROM Opportunity WHERE Id=:op1.Id];
 
        //check calculation Prices
        OpportunityLineItem ol1 = new OpportunityLineItem(OpportunityId=op1.Id, 
            UnitPrice=123.00, Quantity=1,Description=null, Discount=100, PricebookEntryId=pe1.Id);

        System.debug(LoggingLevel.INFO, '**********Before Insert Id=null ListPrice= '
        +ol1.ListPrice+' UnitPrice=' + ol1.UnitPrice+' Discount='+ol1.Discount+' TotalPrice='+ol1.TotalPrice);

 

 

14:17:14.598 (1598203000)|USER_DEBUG|[27]|INFO|**********Before Insert Id=null ListPrice= null UnitPrice=123.00 Discount=100 TotalPrice=null

        insert ol1;

       OpportunityLineItem ol2=[Select  o.UnitPrice, o.TotalPrice,
       o.Quantity, o.PricebookEntryId, o.ListPrice,
       o.Id, o.Discount From OpportunityLineItem o where o.id=:ol1.Id];
        
        System.debug(LoggingLevel.INFO, '**********After Insert Id='+ol2.Id+
        ' ListPrice= '+ol2.ListPrice+' UnitPrice=' + ol2.UnitPrice+
        ' Discount='+ol2.Discount+' TotalPrice='+ol2.TotalPrice);

 

14:17:14.688 (1688622000)|USER_DEBUG|[34]|INFO|**********After Insert Id=00kG000000HBCU9IAP ListPrice= 444.00 UnitPrice=123.00 Discount=100.00 TotalPrice=0.00

 

OKAY

 

 		Update ol2;
 		
 
        OpportunityLineItem  ol3=[Select  o.UnitPrice, o.TotalPrice,
        o.Quantity, o.PricebookEntryId, o.ListPrice, o.Id,
        o.Discount From OpportunityLineItem o where o.id=:ol2.Id];
 
        System.debug(LoggingLevel.INFO, '**********After Update '
        +ol3.Id+'ListPrice= '+ol3.ListPrice+ ' UnitPrice=' 
        + ol3.UnitPrice+' Discount='+ol3.Discount+' TotalPrice='
        +ol3.TotalPrice);

 

14:17:14.739 (1739783000)|USER_DEBUG|[42]|INFO|**********After Update 00kG000000HBCU9IAPListPrice= 444.00 UnitPrice=null Discount=100.00 TotalPrice=0.00

 

Problem: UnitPrice is set to null. Trying to hide this by setting TotalPrice to null:

 

	//Try to set TotalPrice to null  because it's 0.0 after update
 	ol2.TotalPrice=null;
  	Update ol2;
 		
 	ol3=[Select  o.UnitPrice, o.TotalPrice, o.Quantity, 
          o.PricebookEntryId, o.ListPrice,o.Id, o.Discount 
          From OpportunityLineItem o where o.id=:ol2.Id];
        
        System.debug(LoggingLevel.INFO,
        '**********After Update with TotalPrice set to null '
         +ol3.Id+'ListPrice= '+ol3.ListPrice+ ' UnitPrice=' 
         + ol3.UnitPrice+' Discount='+ol3.Discount+' TotalPrice='
         +ol3.TotalPrice);

 

14:17:14.790 (1790286000)|USER_DEBUG|[50]|INFO|**********After Update with TotalPrice set to null 00kG000000HBCU9IAPListPrice= 444.00 UnitPrice=123.00 Discount=100.00 TotalPrice=0.00

 

OKAY! But what if user updates a second time:

 

 	//Try to set TotalPrice to null again because it's 0.0 after update
  	ol2.TotalPrice=null;
  	Update ol2;

	ol3=[Select  o.UnitPrice, o.TotalPrice, o.Quantity, 
          o.PricebookEntryId, o.ListPrice,o.Id, o.Discount 
          From OpportunityLineItem o where o.id=:ol2.Id];
 
         System.debug(LoggingLevel.INFO, 
        '**********After 2. Update with TotalPrice set to null '
        +ol3.Id+'ListPrice= '+ol3.ListPrice+ ' UnitPrice=' 
        + ol3.UnitPrice+' Discount='+ol3.Discount+' TotalPrice='
        +ol3.TotalPrice);
 
    }
}

 

14:17:15.099 (2099067000)|FATAL_ERROR|System.DmlException: Update failed. First exception on row 0 with id 00kG000000HBCU9IAP; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: TotalPrice (total price must be specified): [TotalPrice]

 

Why can't I update the same record twice with TotalPrice set to null? Maybe I'm wrong with anything...

 

Any explainings for this behavior? I urgently need an idea how to solve this trouble. Seems to be the same problem in Winter’12 and Spring ’12.

 

Thanks in advance,

Elke

  • February 02, 2012
  • Like
  • 0