How to default Validity date to certain days from Date of creation for Sales Quote module

By | September 30, 2021

In Sage X3, Users can create Sales Quotes for keeping a track of which customer has placed their quotes for the products. When these quotes are created from the screen then the date of creation is defaulted to current date, there is another field in the Management tab of the screen called Validity date which is to keep track of the particular quote’s validity.
This Validity field is not mandatory so oftentimes users can forget it and it remains empty. But the data stores for such a field is defaulted to 1st Jan 1947 which is of no use for tracking. So in this blog, we’ll be showing a way to get a default value for the Validity field that’ll be referenced after certain days from the date of creation.

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

Sales Quote: All > Sales > Quotes > Quotes
Window management: All > Development > Script dictionary > Windows
Script Editor: All > Development > Script dictionary > Script editor

For the purpose of making things clear refer below screenshots:

New Stuff: How to solve warning “Non-blocking difference Warning format PLICRDIDX K10c Sage X3” while importing data through template

[Date of creation & Validity date on Sales Quote screen]
[Date of creation & Validity date on Sales Quote screen]

Now that we’re familiar with the screens, below are the steps for setting up default value for Validity date field:

Step 1: Navigate over to the Sales quote window in the Window management under development using the code OSQH, there you can see all the linked screens for the window.

Step 2: We need to make sure that as soon as the user enters the Site code in the Sales quote screen then the validity date defaults itself. For this we’ll have to set up action events (After field & After change) on the site field in header screen SQH0 and validate the screen. Below are the screenshots showing the same:

[Sales site field on Header screen]
[Sales site field on Header screen]
[After change and After field SPE action events of Sales site field]
[After change and After field SPE action events of Sales site field]

Step 3: Once the validations are done, we need to add the script logic for these action events in the specific script SPESQH. We’re considering the default value to be 30 days from date of creation (QUODAT), below is the logic we’ve used:

[Script part for After field and After change events]
[Script part for After field and After change events]

Here the validity field exists on the Management tab screen (SQH1) as VLYDAT. Once the script is written, compile the part to check if any error is there.

Step 4: After the successful compilation, in a new Sage X3 tab open the Sales quote module and test whether the default value is setting after site code.

In this way, we can set a default date for the Validity date field corresponding to the date of creation.