Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, February 23, 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!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Item cannot be found in the collection corresponding to the requested name or ordinal
matben3
Posts: 4
 
Item cannot be found in the collection corresponding to the requested name or ordinalYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Jan 12 10:56 AM
fiogf49gjkf0d

Hy everyone, I'm a new user of this board.


I have a problem with a costumization in Saleslogix v 7.2.2 and I hope that someone can help me


 


Thats my problem:


The main goal of this costumization is add two fields in Add Opportunity Product view. The values of this two fields should be appear in the product grid when I click on Add button.


I followed this step:


1) I created two fields in table Opportunity_Product: ACCOUNTMANAGERID2 (varchar) and OPPORTUNITYSTATUS (varchar)


2) I edited the script Insert Oppotunity Comon in this way:    


Set col = grdProducts.Columns.Add(0)
    col.FieldName = "ACCOUNTMANAGER2"
    col.Caption = "Commerciale"
    col.Width = 40
    Set col = grdProducts.Columns.Add(0)
    col.FieldName = "STATUS"
    col.Caption = "Stato"
    col.Width = 40


---------


    .Fields.Append "ACCOUNTMANAGER2", adVarChar, 64
    .Fields.Append "STATUS", adVarChar, 12


3) Edited the Opportunity:Products view in this way:


In the sub PopulateDataGrid I changed the query:


strSQL = "Select op.OPPPRODUCTID, op.PRODUCTID, op.PRICE, op.DISCOUNT, op.QUANTITY, " & _
             "op.CALCPRICE, op.EXTENDEDPRICE, op.SORT, op.PROGRAM, op.ACCOUNTMANAGER2, op.OPPORTUNITYSTATUS, " & _
             "p.NAME, p.FAMILY " & _
             "From OPPORTUNITY_PRODUCT op " & _
             "Inner Join PRODUCT p " & _
             "On (op.PRODUCTID = p.PRODUCTID) " & _
             "Where OPPORTUNITYID = '" & strOpportunityID & "' " & _
             "Order By op.SORT"


and I add this two lines to the grdProducts.recordset definition:


objPrdRS.Fields("ACCOUNTMANAGER2").Value = "" & .Fields("ACCOUNTMANAGER2").Value 
objPrdRS.Fields("STATUS").Value = "" & .Fields("OPPORTUNITYSTATUS").Value 


4) Always in Add Product Opportunity I edited the sub AddProductToGrid(objRS, intQty):


.Fields("ACCOUNTMANAGER2").Value = comm                                
.Fields("STATUS").Value = st


where comm and st are two variables that contain the values of the two fields that I added in Add Opportunity Product view.


 


Now the problem is:


If I add a product from the Opportunity:Products's grid making a right click of the mouse everithing works fine. The Add Opportunity Product is open and I have no problem.


However the problem occour when I cal Add Opportunity Product view from Insert New Opportunity form. In this case the Add opportunity Product View opened correctly but when I click "Add>" I got this error:


"Item cannot be found in the collection corresponding to the requested name or ordinal" in the script Add Opportunity Product line 538 char 10 that correspond at this two lines:


.Fields("ACCOUNTMANAGER2").Value = comm                                
.Fields("STATUS").Value = st


It seems that the grdProducts.recordset doesn't have this two field?? How could be possible? Whats I'm wrong?


Thank you, I hope that someone help me because I'm desperate...


Sorry for my English...


 

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Item cannot be found in the collection corresponding to the requested name or ordinalYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Jan 12 12:58 PM
fiogf49gjkf0d

In the Add Product form - check the include script (Insert Opportunity Common) - you have missed the recordset that it creates. Around 298 - Function CreateProductsRSStructure

[Reply][Quote]
matben3
Posts: 4
 
Re: Item cannot be found in the collection corresponding to the requested name or ordinalYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Jan 12 2:00 AM
fiogf49gjkf0d

Thanks for the answer but unfortunatly I had made it.


I wrote not so clearly in the first post but I create the recordset adding the two lines that you can see in the step 2 after the ------ lines. Sorry for my imprecision.


I can't understand, it's look like the recordset passed trough the Insert Opportunity view is different...


 


I'm desperate again (

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Item cannot be found in the collection corresponding to the requested name or ordinalYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Jan 12 2:28 AM
fiogf49gjkf0d

OK, think I know what the answer is. The user has the ability to store there own personal products when generating an opportunity. You will find this in Tools | Manage | Opportunity Defaults (Products at bottom of form). The issue is that the user defined grid doesn't contain these two new columns and this is what it attempts to load.


So, in SQL do this:


 delete from USEROPTIONS where NAME in ('PRODUCTS','PRODUCTSGRIDLAYOUT') AND CATEGORY = 'OPPORTUNITYDEFAULTS'



 



I suspect you are getting a product back (which won't have the columns you added). You should then restart SLX to clear the cache of user options.

[Reply][Quote]
matben3
Posts: 4
 
Re: Item cannot be found in the collection corresponding to the requested name or ordinalYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jan 12 4:37 AM
fiogf49gjkf0d

Sorry but I don't understand your suggestion...


I added the two columns at the Product Grid trough the script Insert Opportunity Common and I see this two columns.


I also added in the DB the two columns in the table OPPORTUNITY_PRODUCT. The problem according to me is what is the recordset used in the Add Product View when you call it from the Insert Opportunity view?


Thank you for try to help me.

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Item cannot be found in the collection corresponding to the requested name or ordinalYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jan 12 4:44 AM
fiogf49gjkf0d

Come out of SLX. Run SQL Studio and, in your database, run this:


 DELETE FROM USEROPTIONS WHERE NAME IN ('PRODUCTS','PRODUCTSGRIDLAYOUT') AND CATEGORY = 'OPPORTUNITYDEFAULTS'


This is non-destructive (does no harm) - but I think will fix your issue. Let me know.

[Reply][Quote]
matben3
Posts: 4
 
Re: Item cannot be found in the collection corresponding to the requested name or ordinalYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jan 12 8:51 AM
fiogf49gjkf0d

IT WORKSS!!!! You're awesome!!!


But for a noob user what represent that SQL that I run? Can you explain in a few word? I'don't want to fix here but broke something else...


However thank you so much!!!

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Item cannot be found in the collection corresponding to the requested name or ordinalYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jan 12 9:01 AM
fiogf49gjkf0d

Good news (I knew it would, I hit it about 3 weeks ago!).


In essence - if you run "select name,optionvalue from useroptions where CATEGORY = 'OPPORTUNITYDEFAULTS'" - notice that SLX stores the layout/geometry for each object on the Insert Opportunity form. You'll also notice one called "ProductsGridLayout" - in here it stores the LAYOUT of the grid (including all the columns) as XML. So, when you mofiy this area you *must* clear this user default - otherwise, the 2 columns (that you added) are not in the layout, hence, not in the recordset either, hence - the Issue !


Hope that helps. It's the *only* place that this occurs so, fortunately, you won't run into this issue again.


Regards
Mike

[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/23/2025 4:12:21 PM