Scripting

  • 1.  Do you have to set a specific variable to have a b

    Posted 03-15-2013 13:57
    Do you have to set a specific variable to have a button open data entry from an inquiry screen? I have a button on so quote history inquiry that should open the sales order entry. Instead it shows it opening the sales order inquiry (although you do have an accept button and can make changes. Just the title of the panel shows sales order inquiry). I believe there is a variable for the object called cInquiryProgram witch should be set to isFALSE but setting that value doesn't seem to do anything.


  • 2.  RE: Do you have to set a specific variable to have a b

    Posted 03-18-2013 01:50
    I checked it out. Looks if you are running the .Process as a pop-up dialog then you'll deal with oddities like this caused by cInquiryProgram ' Child Dialog If Not(IsObject(oUI)) Then Set oUI = oSession.AsObject(oSession.GetObject(""SO_SalesOrder_UI"")) End If retVal = oUI.Process() But if you do it as an independent window it should work: ' Independent window retVal = oSession.InvokeProgram(""SO_SalesOrder_UI"") There is 1 other way to make it work too (which is basically doing an InvokeProgram or InvokeTask). In the Customizer button instead of MS Script use the old radio button called Program, then set the Module to Sales Order and the Task to Sales Order Entry.


  • 3.  RE: Do you have to set a specific variable to have a b

    Posted 03-18-2013 12:31
    @AlnoorCassim you are correct. I was able to set the invokeprogram and it worked as expected. Means I can not lock the user from changing the inquiry screen or force them to close the entry screen before they can inquire again. Might not be a big deal in this case. Thanks so much for looking at it. I was going crazy trying to figure out why it would say inquiry but let me make changes. I was too focused to think about checking to see if the invokeProgram did the same. I did check with doing just a button to open the program. The button would open the entry screen as expected. I didn't think you could pass the key to read when you use a button like that? I needed it to open a specific order based on the inquiry screen.


  • 4.  RE: Do you have to set a specific variable to have a b

    Posted 03-18-2013 12:47
    Todd you can pass the current order (key) on the History screen to S/O Entry. SO = """" retVal = oBusObj.GetValue(""SalesOrderNo$"", SO) retVal = oScript.InvokeButton(""BT_OKVIEW"") ' press the OK button to clear screen retVal = oBusObj.Clear() ' in case History has the order EXTRACTed retVal = oSession.InvokeProgram(""SO_SalesOrder_UI"", SO) But remember if that order has been fully invoiced then S/O Entry shows the infamous ""order already exists in history"" Now if you still wanted to use the child dialog so they are forced to close down the screen (I totally get that), the first 3 lines above are same then: If Not(IsObject(oUI)) Then Set oUI = oSession.AsObject(oSession.GetObject(""SO_SalesOrder_UI"")) End If retVal = oUI.Process(SO)


  • 5.  RE: Do you have to set a specific variable to have a b

    Posted 03-18-2013 12:59
    Your first example is what I am doing and how I have it working but I I do not clear the screen. I only allow opening order entry if the status is (A)ctive. sSONum = """" sSOStatus = """" retVal = oBusObj.GetValue(""OrderStatus$"",sSOStatus) retVal = oBusObj.GetValue(""SalesOrderNo$"",sSONum) if sSOStatus = ""A"" then retVal = oSession.InvokeProgram(""SO_SalesOrder_UI"",sSONum) end if If sSOStatus <> ""A"" then msgbox ""Sales Order: ""+sSONum+"" is not an active Sales Order!"",16,""Invalid Sales Order Number"" end if If I do the second option that you have then I will get the Sales Order Inquiry instead of the Sales Order Entry. At least that is the title. It will still allow you to make changes to the order and save it . Seems like a bug to me. If it says inquiry then I should not have the accept button and be able to make changes. .


  • 6.  RE: Do you have to set a specific variable to have a b

    Posted 03-18-2013 13:03
    Do you want actual SO Inquiry to open? Change the InvokeProgram to use SO_SalesOrderInquiry_ui instead. Also put this DropSession at the end: retVal = oSession.DropObject(""SO_SalesOrderInquiry_UI"")


  • 7.  RE: Do you have to set a specific variable to have a b

    Posted 03-18-2013 13:27
      |   view attached
    No I didn't want to open inquiry at all. That is the whole issue. Because we are doing a .process from an inquiry screen (SO quote history) it is opening the SO Inquiry instead of the Entry screen when I do a process to SO_SalesOrder_UI. (note that the title says it is inquiry but I can save and make changes which is what I want to be able to do). I am guessing that since the .process inherits the values set in the parent program that it thinks it is going to open inquiry and not entry. Yet some of the logic allows the accept button and hides the OK button and allows for changes to be made. The screen shot I included here is what happens if you try to use process from the Sales Order and Quote History Inquiry.


  • 8.  RE: Do you have to set a specific variable to have a b

    Posted 03-18-2013 16:07
    That's what I thought you meant from your original post and how I originally tested it but later thought you meant otherwise. In the end I don't think you can pass any ""c"" variables from a script. But using .Process and setting cInquiryProgram seems to work for me if I change my button to run a PERFORM instead. Try this: 1. Create a brand new button - point it to MS Script 2. Your script code will have this one line. MAS_SCR_PFM = ""../SO/SO_RunSOEntryFromHistory.m4p"" ' call it what u want 3. Create a text file in SO folder, save it as SO_RunSOEntryFromHistory.m4p 4. Put something like this in there coBusiness'GetValue(""SalesOrderNo$"", SO$) coBusiness'GetValue(""OrderStatus$"", sOrderStatus$) IF sOrderStatus$ = ""A"" { cInquiryProgram = isFALSE oSO = NEW(""SO_SalesOrder_UI"", %SYS_SS) oSO'Process(SO$) DROP OBJECT oSO, ERR=*NEXT oSO = 0 } ELSE { tmpMessageText$ = ""Not an Active Order "" + SEP + ""Unable to Edit."" %SYS_SS'UI'MessageBox$("""", tmpMessageText$, tmpMessageOptions$) } EXIT