Scripting

  • 1.  I have another one...it's just not a good scriptin

    Posted 05-09-2018 20:12
    I have another one...it's just not a good scripting day for me. I want to be able to create a button on the Header tab of BM Maintenance to connect to the CI_Item_bus and get/set the Item Desc field into the bill being created. This is because the standard system is ""working as designed"" to copy the Bill Desc from the source bill when using ""Copy From"" rather than using/keeping the original Item Desc, so client wants me to put in an override. But the button script will not recognize the oBusObj.GetValue(""BillNo$"", sBillNo) line at the beginning of the script. So I try to test out my script using a Column Post-Validate and cannot even select the BillNo column. Why wouldn't I be able to read that field to use in my script?? Am I missing something stupid?


  • 2.  RE: I have another one...it's just not a good scriptin

    Posted 05-09-2018 20:18
    In your post validate script, did you add the field using the drop down table and field selector or type it out? Not in front of PC at the moment so I can't verify the field name is correct. But you might want to verify what fields it has in the drop down for the bm header.


  • 3.  RE: I have another one...it's just not a good scriptin

    Posted 05-09-2018 20:21
    Is Allow External Access turned on in Company Maintenance, Preferences tab?


  • 4.  RE: I have another one...it's just not a good scriptin

    Posted 05-09-2018 20:31
      |   view attached
    In the button script, I am not passing any variables...I'm just trying to get the Bill No so that I can match it up to the Item Code from Item Maintenance but I can't get it (I've closed out of the client's system so I can't exact error again, but it doesn't like oBusObj.GetValue(""BillNo$"", sBillNo). When I try a Post-Validate script instead just to test my script another way, I cannot select BillNo from the list seen in the attachment (I was not clear about this part the first time).


  • 5.  RE: I have another one...it's just not a good scriptin

    Posted 05-09-2018 20:36
    Column events can't be used on columns that are part of the primary key. You can use the table post read event instead. It will fire for new and existing records whenever a bill number is keyed in or returned from the lookup. Also, like @DanBurleson said, make sure Allow External Access is checked for the company.


  • 6.  RE: I have another one...it's just not a good scriptin

    Posted 05-09-2018 20:38
    Thank you both - will check on the External Access tomorrow. Now that I think about it, the is the first script they will have so it may not be enabled yet.


  • 7.  RE: I have another one...it's just not a good scriptin

    Posted 05-10-2018 06:28
    Button script needs to be run from the ""server"" to have access to business objects. You could also try a UI trigger...


  • 8.  RE: I have another one...it's just not a good scriptin

    Posted 05-10-2018 09:53
    Kevin - after I changed to ""server"" I was able to get farther than I was and finally fixed the rest of my script to work. I have also made a note for myself to use Server for buttons...why I never did that before is beyond because I can never remember. Thank you for the push!!