5.14.1.2.4.3. Check Before the ERP Dialog (3Dfindit)

Before the " New Ident Number [new ident-no.] " dialog opens in 3Dfindit, a script on the server can check whether certain prerequisites are met. Depending on the result, it prompts the user for input, displays a message, or terminates the process with a message, preventing the dialog box from opening. The script does not modify any data.[79]

[Note]Note

The test applies only to 3Dfindit, not to PARTdataManager.

Configuration

Wear Enter the compiled script ( .vbb ) in the erpcustom.cfg :

[SERVER_BEFORE_SHOWDIALOG]
1=$CADENAS_SETUP/scripts/erp/
 erp_before_showdialog.vbb

If the check is to apply only to a specific role, the block is [SERVER_BEFORE_SHOWDIALOG(<groupName>)].

The script contains the Execute(context) function. It must return 1 . Any other value or exception is considered an error.

The context object

Via context, the script has access to the following information and messages:

Table, Document

Spreadsheet and document. Read-only.

QueryConfirmed

True if the request is repeated after the user has confirmed a prompt or a message . Read-only.

Ask(message [, title [, confirmText [, cancelText]]])

Displays a prompt. If the user confirms, the dialog box opens; if the user cancels, the process ends. Optionally, you can specify the window title and the labels for the two buttons.

ShowInfo(message [, title [, buttonText]])

Displays a message. After you confirm, the dialog box opens. Optionally, you can specify the window title and the button label.

StopWithInfo(message [, title [, buttonText]])

Displays a message and terminates the process. The dialog box does not open, even on the second run after confirmation. Optionally, you can specify the window title and the button label.

[Note]Note

After confirmation, the script runs a second time. Ask and ShowInfo are ignored in this process, so you do not need to call QueryConfirmed. If the script has side effects, such as writing entries to a log file, call QueryConfirmed to ensure that nothing is done twice .

Example

Before the dialog box opens, the user is asked if they would like to continue :

Function Execute(context)
  context.Ask("Do you want to continue to the ERP dialog?", _
    "Assign ERP number", "Proceed", "Stop")
  Execute = 1
End Function