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 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.
Best answer by aaghaei
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.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.