How to set dynamic Status field on screen based on date range

In Sage X3, one of the client’s requirement was to have a dynamic “Policy Status” field which will reflect the current status where the policy is Active or De-active for the selected module. Here another condition was that at a given time span only one policy per module can be kept Active, rest will stay deactivated and will get activated automatically once the date condition is satisfied.

First to navigate to the screens that’ll be used for the below steps:

Window management: All -> Development -> Script dictionary -> Window management
Script editor: All -> Development -> Script dictionary -> Scripts -> Script editor
Tables: All -> Development -> Data and parameters -> Tables

To fulfill the above mentioned requirement we need to follow the below steps:

Step 1: Below are the locations showing the “Status and Applicable module” fields on screen, on window management and on the linked table of the screen. Refer the screenshots for reference:

New Stuff: Validation on the Sales order screen if credit limit exceeds

Module and Status fields on screen
Module and Status fields on screen

Status field under Header tab in Window management
Status field under Header tab in Window management

Status field in linked table of Header screen
Status field in linked table of Header screen

Step 2: For this customization we need to add some action events. The script code for the screen can be identified from Window management > Header screen > Specific script.

The logic for them will be as follows:
Once the user clicks the “New” button on screen to create a new policy and selects the Applicable Module our logic part will trigger that will check whether there is any existing Policy already for the given Module and if it does then whether it’s currently Active or Inactive.
In case the Policy exists and is Active, the Status field is made non-editable using the DISZO command followed by AFFZO command and set to DEACTIVE. Whereas if the Policy exists but is in Inactive status, then it’ll allow the user to select the status as per choice.

Case of Active existing Policy on module
Case of Active existing Policy on module

Step 3: Now when a new policy is created for a given date range, then another logic is added on the LIENS action event in script which gets triggered whenever the Entry no. is browsed from left list selection or opening the screen.

This logic checks if the current date is within the Policy date range first and then:
If the current date is within the date range then it’ll check if the status is Active or De-active.
For the Active case the logic will return from the event without any change.
For the De-active case the logic will check if there is any existing Active policy for the module, if not then it’ll change the status to ACTIVE on the screen and trigger an Update instruction on the table.

If the current date exceeds the To date of Policy:
For the Active case the logic will change the status to DEACTIVE and make the field non-editable using the DISZO command followed by AFFZO command, and update the table using the Update instruction.
For the De-active case logic will return from the event without any change.

This way we can dynamically set the status field on screen based on the policy date range.

About Us

Greytrix – a globally recognized and one of the oldest Sage 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 CRMSalesforce.com, 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 Sales Commission App for Sage X3 simplifies commission calculations and postings on sales transactions.

The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for processing and execution of application programs at the click of a button.

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 x3@greytrix.com, We would like to hear from you.