Solved

Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

  • 29 December 2022
  • 4 replies
  • 208 views

Userlevel 3
Badge

 

Hi All,

I’m getting the below error in Service Order screen, 

Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

 

 

please assist.

icon

Best answer by aaghaei 30 December 2022, 02:35

View original

4 replies

Badge +18

Hello @sujithra ,

More information is needed, please.

  • Are you seeing the above message upon opening the Service Orders Preview List?  Or, are you seeing the above message upon selecting a service order to the screen? 
  • Is there any additional information in Tools → Trace? 
  • Is the Service Orders Preview List customized? 
  • What changed since this screen last worked correctly?

 

Thank you!

Userlevel 4
Badge +1

 

Hi All,

I’m getting the below error in Service Order screen, 

Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

 

 

please assist.



Hi @sujithra ,

This is most likely due to a customization or lack of a customization that the screen is looking for. 

If there are NO any ISV customizations; Please unpublished all customizations and see if the issue persists. 

If issue still persists or if you have any ISV customizations I suggest you to create support case on Acumatica (With access)  as this error should be investigate further.

Thanks!

Userlevel 3
Badge

Hi @laura01,

Yes, I’m trying to customize service order screen.

I’m trying to add column AddressLine1 and AddressLine2 to the existing selector Location Field in Service order screen from Customer Location screen(AR303020). 

 

 

here is my code and not getting any error in Visual studio,

 

 

kindly assist if anything I’m missing/wrong in my code.

 

Userlevel 7
Badge +9

@sujithra

The below code will do the work for you. You can add more fields to the selector following this footstep:

using PX.Data;
using PX.Objects.CR;
using PX.Objects.CS;

namespace PX.Objects.FS
{
[PXNonInstantiatedExtension]
public sealed class USRFSServiceOrderExt : PXCacheExtension<PX.Objects.FS.FSServiceOrder>
{
public static bool IsActive() => true;

#region LocationID
[PXMergeAttributes(Method = MergeMethod.Merge)]
[PXSelector(typeof(Search2<Location.locationID,
LeftJoin<Address, On<Address.addressID, Equal<Location.defAddressID>>>,
Where<Location.bAccountID, Equal<Current<FSServiceOrder.customerID>>,
And<Location.isActive, Equal<True>,
And<MatchWithBranch<Location.cBranchID>>>>>),
typeof(Location.locationCD),
typeof(Location.descr),
typeof(Address.addressLine1),
typeof(Address.addressLine2),
typeof(Address.addressLine3),
SubstituteKey = typeof(Location.locationCD),
DescriptionField = typeof(Location.descr))]
public int? LocationID { get; set; }
#endregion
}
}

And this is the screenshot from the Location Selector:

 

 

If you still face error after this change, you may have issues elsewhere.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved