Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Wednesday, February 19, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: 7.2 web having issue adding an new Opportunity
Paul
Posts: 5
 
7.2 web having issue adding an new Opportunity Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Jan 08 4:47 PM
I am having an issue with the new 7.2 web client. After upgrading a 6.2 database and fully testing the 7.2 desktop client I am now working on the web client implementation. I have tested most of the website without issue but when I attempt to add a new Opportunity I get the following error:

***********************************
Server Error in '/' Application.

Input string was not in a correct format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:

Line 1822: DynamicMethodLibrary lib = DynamicMethodLibraryHelper.Instance;
Line 1823: Object[] methodArgs = new Object[] { instance };
Line 1824: lib.Execute("Opportunity.OnCreate", methodArgs);
Line 1825: return instance;
Line 1826: }

***********************************

My assumption was that there is a database issue so I attached the evaluation database and connected the same site to it. sure enough I can add a new Opportunity to it. I have reviewed all of the Opportunity% tables in my upgraded DB and they have the exact same structure as the Eval DB. Just for sanity sake I also replaced all of the upgraded DB Opportunity% tables with the ones from the EVAL DB but still no success. I have been using VSS to debug but am unable to make any headway even while stepping through.

I would really appreciate any insight or help on how to identify the underlying issue.

Thanks in advance
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: 7.2 web having issue adding an new Opportunity Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Jan 08 11:21 PM
Believe it or not, I spent quite some time tracking down this issue. Definitely not a fun day. Hehe. I have reported it to Sage, but haven't gotten a defect number on it yet, The problem is that the opportunity defaults from the current user are incomplete. When the web client tries to load the data as XML it is failing (BTW, the LAN client loads this data into XML differently so it won't cause this error).

To solve this, simply log into the LAN client (sorry no way to do this in the web). Open the opp defaults screen and then click the OK/Save button to save it. That is it. This will save the XML as an empty set and this will be valid. Here's the write up I did when I reported it to Sage:

--------------------------------------------------------------------

I have a customer who could not bring up the Insert New Opportunity Screen. After stepping through things with VS I determined that I was getting an error in the GetOppProductDefaults business rule on the Opportunity entity. The GetOppProductDefaults method looks like this:

public static void GetOppProductDefaults(IOpportunity opportunity)
{
string commonOption = ApplicationContext.Current.Services.Get<IUserOptionsService>().GetCommonOption("Products", "OpportunityDefaults");
if (commonOption != "")
{
commonOption = commonOption.Substring(commonOption.IndexOf("<rs:data>")).Replace("rs:data>", "rsdata>").Replace("z:row", "zrow").Replace("</xml>", "");
XmlDocument document = new XmlDocument();
try
{
document.LoadXml(commonOption);
foreach (XmlNode node in document.SelectSingleNode("rsdata").ChildNodes)
{
if (node.Attributes["PRODUCTID"].Value != null)
{
IOpportunityProduct item = EntityFactory.Create<IOpportunityProduct>();
item.Opportunity = opportunity;
item.Product = EntityFactory.GetById<IProduct>(node.Attributes["PRODUCTID"].Value);
item.Sort = new int?(Convert.ToInt32(node.Attributes["SORT"].Value));
item.Program = node.Attributes["PRICELEVEL"].Value;
item.Price = new decimal?(Convert.ToDecimal(node.Attributes["PRICE"].Value));
item.Discount = new double?(Convert.ToDouble(node.Attributes["DISCOUNT"].Value));
item.Quantity = new double?(Convert.ToDouble(node.Attributes["QUANTITY"].Value));
item.ExtendedPrice = new decimal?(Convert.ToDecimal(node.Attributes["EXTENDED"].Value));
opportunity.Products.Add(item);
}
}
}
catch (Exception)
{
throw new Exception("Invalid xml for default Opportunity Products");
}
}
}


The stack trace from the exception showed the following:

   at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at System.String.Substring(Int32 startIndex)
at Sage.SalesLogix.Opportunity.Rules.GetOppProductDefaults(IOpportunity opportunity)
at Sage.SalesLogix.Opportunity.Rules.CheckOppAccount(IOpportunity opportunity, Boolean& result)
at (Object )
at Sage.Platform.DynamicMethod.DynamicMethodLibrary.Execute(String methodName, Object[] args)


You'll notice that the exception was thrown from the attempt to use Substring on a string within the GetOppProductDefaults method. The Substring is used to get only the XML between the tags from the serialized XML from the Recordset stored there, ignoring the schema data from the beginning section of the XML. So, I looked and this is what this customer has stored there for *all* users for the Products in the OpportunityDefaults user option:

<xml xmlns:z="#RowsetSchema" xmlns:rs="urn:schemas-microsoft-com:rowset">
<s:Schema id="RowsetSchema">
<s:ElementType name="row" content="eltOnly" rs:updatable="true">
<s:AttributeType name="SORT" rs:number="1" rs:write="true">
<s:datatype dt:type="int" dt:maxLength="4" rs:precision="0"
rs:fixedlength="true" rs:maybenull="false"/>
</s:AttributeType>
<s:AttributeType name="PRODUCTID" rs:number="2" rs:write="true">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="12"
rs:precision="0" rs:maybenull="false"/>
</s:AttributeType>
<s:AttributeType name="KEYFIELDID" rs:number="3" rs:write="true">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="16"
rs:precision="0" rs:maybenull="false"/>
</s:AttributeType>
<s:AttributeType name="PRODUCT" rs:number="4" rs:write="true">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="64"
rs:precision="0" rs:maybenull="false"/>
</s:AttributeType>
<s:AttributeType name="FAMILY" rs:number="5" rs:write="true">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="64"
rs:precision="0" rs:maybenull="false"/>
</s:AttributeType>
<s:AttributeType name="PRICELEVEL" rs:number="6" rs:write="true">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="32"
rs:precision="0" rs:maybenull="false"/>
</s:AttributeType>
<s:AttributeType name="PRICE" rs:number="7" rs:write="true">
<s:datatype dt:type="number" rs:dbtype="currency" dt:maxLength="8"
rs:precision="0" rs:fixedlength="true" rs:maybenull="false"/>
</s:AttributeType>
<s:AttributeType name="DISCOUNT" rs:number="8" rs:write="true">
<s:datatype dt:type="float" dt:maxLength="8" rs:precision="0"
rs:fixedlength="true" rs:maybenull="false"/>
</s:AttributeType>
<s:AttributeType name="ADJPRICE" rs:number="9" rs:write="true">
<s:datatype dt:type="number" rs:dbtype="currency" dt:maxLength="8"
rs:precision="0" rs:fixedlength="true" rs:maybenull="false"/>
</s:AttributeType>
<s:AttributeType name="PRICELOCAL" rs:number="10" rs:write="true">
<s:datatype dt:type="number" rs:dbtype="currency" dt:maxLength="8"
rs:precision="0" rs:fixedlength="true" rs:maybenull="false"/>
</s:AttributeType>
<s:AttributeType name="QUANTITY" rs:number="11" rs:write="true">
<s:datatype dt:type="float" dt:maxLength="8" rs:precision="0"
rs:fixedlength="true" rs:maybenull="false"/>
</s:AttributeType>
<s:AttributeType name="EXTENDED" rs:number="12" rs:write="true">
<s:datatype dt:type="number" rs:dbtype="currency" dt:maxLength="8"
rs:precision="0" rs:fixedlength="true" rs:maybenull="false"/>
</s:AttributeType>
<s:AttributeType name="EXTENDEDLOCAL" rs:number="13"
rs:write="true">
<s:datatype dt:type="number" rs:dbtype="currency" dt:maxLength="8"
rs:precision="0" rs:fixedlength="true" rs:maybenull="false"/>
</s:AttributeType>
<s:extends type="rs:rowbase"/>
</s:ElementType>
</s:Schema>

</xml>


There is no <rs:data> section in this XML, so obviously, that is why the use of Substring is failing, because the IndexOf is returning an invalid integer for a start position. Normally, in any other system I've checked so far, this XML is completely blank for users that have never set any defaults. For a user that goes into the dialog to set the defaults and clicks OK without selecting any default products they will have the XML, but an empty <rs:data> section. Empty is OK, because at least it exists and the code above will not fail.

So, I have no idea what caused the XML to get saved this way in the first place. I will continue to look for this in other systems, but I wanted to mention all this here in case others run into this. This is all fixed by having these users simply go into the Opportunity Defaults dialog (in the LAN client) and just clicking OK. This will cause the empty <rs:data> section to be added to the XML for the serialized recordset and then all wil work fine.

I was originally going to suggest that the code for the GetOppProductDefaults be changed to check the IndexOf the "<rs:data>" section frst before proceeding to get the Substring. This certainly would have saved me some headache since the code would not have completely crapped out for this customer - but I have no idea how this got stored this way for this customer in the first place, so no telling how common this scenario would be. The weird thing is that the XML is like this for *all* users for my customer. This was an upgrade BTW, but so was my own internal database and it doesn't have this problem.

--------------------------------------------------------------------

Hope that helps,
-Ryan
[Reply][Quote]
Mark Dykun
Posts: 297
 
Re: 7.2 web having issue adding an new Opportunity Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Jan 08 6:47 AM
There are a few places where it may have problems with previous data. I found that one of my customers had an issue on the options pages when going to the first tab it would crash. Basically after a debug I found that in the user options the log to History indicator was saved as 0/1 where as the lookup xml file bound to the dropdown control was Y/N. I wrapped the code with some conditional code and away I went. I think this is happening because of upgrade data that does not get upgraded. It makes sense here as it is more then a field conversion.

I agree that a guard should be written around the indexof, basically assigning a local variable to the value of indexof and checking for a value > -1.

Mark
[Reply][Quote]
Paul
Posts: 5
 
Re: 7.2 web having issue adding an new Opportunity Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Jan 08 12:26 PM
Ryan,
Thank you so much for your help. Our tracebacks were different but you lead me exactly to the right place. I did what you suggested and it solved the issue.

I am curious how you were able to troubleshoot to GetOppProductDefaults. I have done an in-file search for this function but have been unable to track it down.

Thanks for any additional advice


Paul
[Reply][Quote]
Paul
Posts: 5
 
Re: 7.2 web having issue adding an new Opportunity Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Jan 08 12:33 PM
Thanks Mark,
I am having a fun adventure tracking down all of the data conversion issues along the way. I am a little nervous of how our production upgrade is going to go. In an effort to avoid issues I am going to try and do several dry runs on copies of the latest production database.

Any advice on doing a clean upgrade would be appreciated

Thanks

Paul
[Reply][Quote]
Paul
Posts: 5
 
Re: 7.2 web having issue adding an new Opportunity Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Jan 08 12:33 PM
Thanks Mark,
I am having a fun adventure tracking down all of the data conversion issues along the way. I am a little nervous of how our production upgrade is going to go. In an effort to avoid issues I am going to try and do several dry runs on copies of the latest production database.

Any advice on doing a clean upgrade would be appreciated

Thanks

Paul
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: 7.2 web having issue adding an new Opportunity Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Jan 08 12:17 AM
Quote:
Originally posted by Paul

I am curious how you were able to troubleshoot to GetOppProductDefaults. I have done an in-file search for this function but have been unable to track it down.


Hi Paul,

Using Reflector. It is a tool you don't want to be without when working with SalesLogix Web. Here's more on this here: http://saleslogixblog.com/rfarley/archive/2008/01/15/38780.aspx

-Ryan
[Reply][Quote]
Mark Dykun
Posts: 297
 
Re: 7.2 web having issue adding an new Opportunity Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Jan 08 6:43 AM
I also host the web client in VS2008 to debug when required. Since it has full debugging including Javascript when those nasty errors come up it is somewhat easier to trace down.

[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: 7.2 web having issue adding an new Opportunity Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Jan 08 10:59 AM
Quote:
Originally posted by Mark Dykun

I also host the web client in VS2008 to debug when required. Since it has full debugging including Javascript when those nasty errors come up it is somewhat easier to trace down.


I do that as well. There's been many issues I could not have tracked down without that. Extremely helpful.

-Ryan
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 2/19/2025 7:41:15 PM