Index Error in 701

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();
> }
>
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();
}
I have 9.04.507A, and will be upgrading to 701 hopefully in April (depends on time I have for testing).

We assign the Project ID via a BPM instead of a customization. A pre-process BPM on the GetNewProject method brings up a BPM Data form, the data from which is stored in a CallContextBPMData field and given to some ABL code in a post-process BPM that folds, spindles, and mutilates it all into an ID (including the current year, the customer ID which had been entered into the BPM Data form, and a counter number stored as a UD field in the Customer table which is then incremented for the next one).

Haven't yet tested it on 9.05.701, but probably within the next couple of weeks.

Ernie Lowell
Diba Industries

--- 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();
> }
>