User Defined Scripting

I have created a JobNumber UDF and added it to AR and AP invoice data entry line detail.  Now I would like to create a User Defined Script for the actual Job Number entered during data entry to be written to the JobNumber UDF.  In AR it comes from the header and in AP it comes from the line detail.  The script that I wrote checks out, but it throws an error 88 when I try to enter an invoice.  Any help will be most appreciated!

Thanks in advance.

  • 0

    ???  Not sure I follow what you are trying to do.

    In your first sentence you indicate you added a JobNumber UDF to AR invoice data entry line detail  and to AP Invoice data entry line detail.  That suggests to me that during invoice data entry you are manually entering that information to the UDFs.

    In the second sentence,  you want to fill in the JobNumber UDFs with a script (which seems to me are already filled in during data entry?).   I assume that you are trying to copy the info from the data entry UDFs to another unnamed file where you have created UDFS?

    I'm lost.

    In addition,  being able to see the script might be helpful to anyone offering assistance.

  • 0

    Is this with or without the presence of the Job Cost module.

  • 0 in reply to TomTarget

    I need a UDF that is populated with the Job Number so I can later run reports using the UDF in SMI.  While I know this sounds a little crazy, the goal is to get the Job Number entered during data entry to populate to the UDF by using a script that essentially says "take what has been entered in the Job Number field and copy it into the UDF.  

    I created a UDF and then wrote a script and added the script to the UDF.  

    I am pretty certain that problem with my script is what follows the , in the parenthesis.  But whatever I have tried to put there so far, hasn't worked.

    retVal = 0

    JobNo = ""

    retVal = oBusObj.GetValue("JobNo$",)

    retVal = oBusObj.SetValue("UDF_JOB_NUMBER$",)

  • 0 in reply to jsmith2

    With the presence of the Job Cost module.

  • 0 in reply to jsmith2

    Try this.

    retVal = 0

    JobNo = ""

    retVal = oBusObj.GetValue("JobNo$",jobno)

    retVal = oBusObj.SetValue("UDF_JOB_NUMBER$",jobno)

  • 0 in reply to TomTarget

    I tried that one before posting my question. Did that work for you? When I used that, it didn't work for me. Maybe I missed a step?  Please let me know. Thanks!

  • 0 in reply to jsmith2

    I should also mention that I am working in Sage 100 ERP 2013.

  • 0 in reply to jsmith2

    Have done similar things  to what you are describing many times successfully.

    Getvalue and setvalue require two parameters,   the field name you are setting/retrieving and the value.

    Assuming you have the field names correct,  my next guess would be that the script itself is not actually firing.

    Put the following at the beginning of your script to verify that the script is actually firing.

    retval = oSession.AsObject(oSession.UI).Messagebox("Script Fired")

    If you don't see a messagebox pop up then

    #1  Make sure in company maintenance that the box for "allow external access" is checked.

    #2  Experiment with which event you have your script tied to.

  • 0 in reply to TomTarget

    Thanks for the suggestion to add the line to see if the script was really firing.  It is!   I did open the AP_InvoiceDetail file, which is the first data entry routine I am testing for this project.  I did verify the JobNo field name and found that the UDF_Job_Number_UDF was actually the correct field name for my UDF.  I made that modification.  However, I haven't moved forward at all because the JobNo is still not populating to my UDF.  This is my current script.

    retval = oSession.AsObject(oSession.UI).Messagebox("Script Fired")

    retVal = 0

    JobNo = ""

    retVal = oBusObj.GetValue("JobNo$",JobNo)

    retVal = oBusObj.SetValue("UDF_JOB_NUMBER_UDF$",JobNo)

  • 0 in reply to jsmith2

    I would suggest sending it to a message box as a test to see if it is reading the JobNo$ field and that there is data there.