Scripting

  • 1.  Want to hard code the Main segment of sales accoun

    Posted 02-09-2016 15:53
    Want to hard code the Main segment of sales account in SO Invoicing. Why doesn't this work? SET oGLAccount = oSession.AsObject(oSession.GetObject(""GL_Account_svc"")) retVal = oGLAccount.Find(""4181"") retVal = oGLAccount.GetValue(""MainAccountCode$"", GLRtnSales) retVal = oHeaderObj.GetValue(""ARDivisionNo$"", division) NewRtnSales = GLRtnSales&""-""&division retVal = oBusObj.SetValue(""SalesAcctKey$"", NewRtnSales, ""kACCOUNT"")


  • 2.  RE: Want to hard code the Main segment of sales accoun

    Posted 02-09-2016 17:36
    You should check your return value after the Find. I could never get partial keys to work. I am assuming you initialized GLRtnSales and division to empty strings.


  • 3.  RE: Want to hard code the Main segment of sales accoun

    Posted 02-10-2016 07:23
    What are you looking for in the Main Account Code? Can't you just assign ""4181""&""-""&division?


  • 4.  RE: Want to hard code the Main segment of sales accoun

    Posted 02-10-2016 08:39
    The oGLAccount.Find() will be looking for a matching AccountKey in GL_Account. I would expect the find() function to fail in this example. if you already know the hard Main account value (""4131"") skip the oGLAccount object entirely.


  • 5.  RE: Want to hard code the Main segment of sales accoun

    Posted 02-10-2016 10:17
    @MichaelNottoli tried that, didn't work so I went to the other method. @DougJenkins I'll try that thanks.


  • 6.  RE: Want to hard code the Main segment of sales accoun

    Posted 02-10-2016 10:57
    I did this and it worked (this was a column post -validate on the item code) GLRtnSales = """" NewRtnSales = """" division = """" Set oUIObj = oSession.AsObject(oScript.UIObj) GLRtnSales = ""4181"" retVal = oHeaderObj.GetValue(""ARDivisionNo$"", division) NewRtnSales = GLRtnSales&""-""&division retVal = oUIObj.InvokeChange(""SalesAcctKey"",NewRtnSales , ""GD_Lines"")


  • 7.  RE: Want to hard code the Main segment of sales accoun

    Posted 02-10-2016 11:01
    That's a neat way to do it @NicoleRonchetti . I ended up using the following, which worked, finally. Mine is column post-validate on shipped qty: retVal = oHeaderObj.GetValue(""ARDivisionNo$"", division) NewRtnSales = ""4181""&""-""&division retVal = oBusObj.SetValue(""SalesAcctKey$"", NewRtnSales, ""kACCOUNT"")