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

By | February 28, 2022

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 Partners is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience and expertise, 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 has some unique integration solutions developed for Sage CRM with Sage ERPs namely Sage X3Sage IntacctSage 100Sage 500, and Sage 300. We also offer best-in-class Sage ERP and Sage CRM customization and development services to Business Partners, End Users, and Sage PSG worldwide. Greytrix helps in the migration of Sage CRM from Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer. Our Sage CRM Product Suite includes addons like  Greytrix Business Manager, Sage CRM Project Manager, Sage CRM Resource Planner, Sage CRM Contract Manager, Sage CRM Event Manager, Sage CRM Budget Planner, Gmail Integration, Sage CRM Mobile Service Signature, Sage CRM CTI Framework.

Greytrix is a recognized Sage Champion Partner for GUMU™ Sage X3 – Sage CRM integration listed on Sage Marketplace and Sage CRM – Sage Intacct integration listed on Sage Intacct Marketplace. The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for the processing and execution of application programs at the click of a button.

For more information on our integration solutions, please contact us at sage@greytrix.com. We will be glad to assist you.