In this step, we are going to add the required script for CUS_MAINT to listen to the event signalled by the Order and change the Address, City and Postcode fields accordingly.
Select the CUS_MAIN script.
We need to add a block of JavaScript to the script to to listen to the "CUS_MAINT_ALIGN" event fired by the click on F24 in Orders and change the fields accordingly.
Look carefully. You must add the block of script in blue after the first opening curly brace:
// You may alter this file to change how new scripts are generated. **NOTE** You must backup
// Script skeleton files are replaced with the standard shipped versions when reinstalling or
{
vHandle_AVEVENT: function(WithId,Sender,WithAInfo1,WithAInfo2,WithAInfo3,WithAInfo4,WithAInfo5,WithNInfo1,WithNInfo2,WithNInfo3,WithNInfo4,WithNInfo5)
{
if (WithId == "CUS_MAINT_ALIGN")
{
SETVALUE("ADDRESS",WithAInfo2);
SETVALUE("CITY",WithAInfo3);
SETVALUE("POSTALCODE",WithAInfo4);
}
return(true);
},
/* ====================================================== */
/* ================== vHandle_ARRIVE ================== */
/* ====================================================== */
The script just added will listen to events but will only do something when the event id is "CUS_MAINT_ALIGN".
For that event, it will update the Address, City and PostCode fields on the customer maintenance screen.