I decided to test out the script on a button. It works perfectly fine. So the only reason I can see this happening is because the index view hasn't loaded yet, even though the script runs after the adapter method. Does anyone know how to get around this? I would prefer not to go the BPM way to try and keep it all in one place.
--- In vantage@yahoogroups.com, "duckorz" <don.n.doan@...> wrote:
>
> I have a script in customization that assigns a newly created project in project entry a project number. This is called when method "GetNewProject" is used. It works fine in 607b but when testing it in 701 I get an error "Index -1 is either negative or above rows count.". I've cleaned it up to make it more readable but it basically gets a number we have stored somewhere else.
>
> I've narrowed it down to this line that is causing the error. Project_DataView[0]["ProjectID"] = projectPrefix + Number;
>
> Does anyone know what changed from 607b to 701 that would cause this error and how to correct it? I've tried assigning different rows to that line just to see if it would work but have had no luck.
>
>
>
> private void getNextProjectNumber() {
> Epicor.Mfg.Core.Session session = (Epicor.Mfg.Core.Session)ProjectEntryForm.Session;
> adapterCompany.GetByID(session.CompanyID);
> if(Project_DataView.Count >=0) {
> String projectPrefix = session.CompanyID;
> Project_DataView[0]["ProjectID"] = projectPrefix + Number;
> }
> adapterCompany.Dispose();
> }
>