How to change Enter key functionality

In sage X3, enter key has some default functionality for e.g. in some screens it is used to trigger OK button functionality while in grid level it is used to jump on the next line and so on. So, depending on the requirement and screen type Enter key has different types of functionalities. But with the help of some coding and actions of screens we can actually block the default functionality of Enter key and can replace it with some other functionalities.

Steps to be followed :

So, in sage X3 when Enter key is pressed, X3 assigns the value of GSTARET to the variable RESPONSE. We can check that condition in the “After choice” action depending on the screens and template that we are using. For different screens and templates different actions are used but most notably APRES_CHOI or AP_CHOIX are used. For the below example we can use APRES_CHOI but depending on the template use we have to see which action is exactly used so it might be differ between the two.

So, in the list of actions we have to specify our action in the specific processing file of the script editor:

Fig : Script Editor
Fig : Script Editor

APRES_CHOI action gets called before executing an action (button, menu, left list, etc.)). A status that defines the action is sent by the supervisor in the RESPONSE variable.

It is possible to short-circuit the normal processing of a button, menu, etc.: This action is used to launch its own processing instead of the template processing, then to put RESPONSE back to 0.

The various possible values for the RESPONSE
variable are given by global variables and various global variables stored the
values of the various actions of button clicks. For example, GSTAENR is used to
store Record button action response and so there are different global variables
within X3 which are used for all sorts of buttons to hold their values and all.

AP_CHOIX action is called right after
“clicking” on a button or a menu.

It is used to execute a processing
after having “clicked” on a button or a menu. In effect, for most of
the buttons, the processing has no standard processing. The processing needs to
be written in this action. The buttons managed by the template are the


This action takes place before the
actions on button ( AVANT_BOUTON, BOUTON and AVANT_XXX, XXX ) where XXX
represents the identifier of the predefined button.

This action takes place before the actions on menu (AVANT_MEN, MEN) The RESPONSE variable contains the status of the button and therefore indicates the button activated by the user and global variables used by buttons to hold the values of their status and response.

Fig : Script Editor

Then in the action handler we can stop
the execution of standard functionality when we assign the value GSTARET to the
variable RESPONSE. We can replace it with new customized functionality which
might be useful.

Once we can make sure that Infbox statement is getting executed when we press “Enter” on screen, we can place something actually useful in its place depending on our needs.

With the help of above steps, you can change the functionality of Enter key.

About Us

Greytrix – a globally recognized and one of the oldest Sage Gold Development Partner is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development and implementation competence.

Greytrix caters to a wide range of Sage X3, a Sage Business Cloud Solution, offerings. Our unique GUMU™ integrations include Sage X3 for Sage, Dynamics 365 CRM and Magento eCommerce along with Implementation and Technical Support worldwide for Sage X3. Currently we are Sage X3 Implementation Partner in East Africa, Middle East, Australia, Asia, US, UK. We also offer best-in-class Sage X3 customization and development services, integrated applications such as POS | WMS | Payment Gateway | Shipping System | Business Intelligence | eCommerce and have developed add-ons such as Catch – Weight  and Letter of Credit and India Legislation for Sage X3 to Sage business partners, end users and Sage PSG worldwide.

Greytrix is a recognized Sage champion ISV Partner for GUMU™ Sage X3 – Sage CRM integration also listed on Sage Marketplace; GUMU™ integration for Sage X3 – Salesforce is a 5-star rated app listed on Salesforce AppExchange and GUMU™ integration for Dynamics 365 CRM – Sage ERP listed on Microsoft AppSource.

For more information on Sage X3 Integration and Services, please contact us at, We will like to hear from you.