Creating Button Scripts

SOLVED

I have general question about writing button scripts in AR_Customer where I can write data to the fields. 

My goal is to update and address Customer Maintenance Main 1: menu with a button that fetches data. 

What I have working is the pulling data from using sage panel variables such as "AR_Customer_bus_AddressLine1"

But I don't know how to write the data to those variables, how do I go about doing that?

Thanks,

Tim

  • +1
    verified answer

    You have two ways to set a value from a button script. 

    1. Using the "Return" option when passing variables to the script.

    You will then assign the value you want returned to the variable passed into the script. Make sure to remove the trailing "$" as they are not valid in a VBScript.

    2. Using the oBusObj.GetValue and oBusObj.SetValue methods. With both methods, you specify the column in the first argument, add a trailing "$" if it is a string column. With the GetValue method, you specify the variable to receive the value as the second argument and you must make sure to first declare the variables intended data type or you will get errors. With the SetValue method, you can pass a variable or literal value as the second argument to be set into the specified column. 

    sAddressLine1 = "" : oBusObj.GetValue "AddressLine1$", sAddressLine1
    sAddressLine1 = sAddressLine1 & " Test"
    oBusObj.SetValue "AddressLine1$", sAddressLine1

    If using the business objects, you should set the button to execute on the server.