I can switch to a command but a filter gives an error when using the avSwitch method.
I have command that displays a list of "Invoices" for the current business object. When I user double clicks on a record, I would like to "switch" to another business object hidden filter (passing an identifier) and let that filter handle presenting an instance list of "time cards" from that invoice.
I have a filter "By Invoice" in the "Time Cards" object already working, I just need to get the user to it and pass the invoice id.
I am currently doing it by saving the invoice id to the virtual clipboard and reusing the "By Invoice" filter get the invoice id from the clipboard.
This works because I only have the one filter, but I am wondering if there is a better way to do this.
I think it will be problematic if/when I have multiple filters and this one is not the default.
Code: Select all
evtroutine handling(#InvoiceList.ItemDoubleClick) #avFrameworkManager.avSaveValue withid1(CMG) withid2(INVOICE_NUMBER) fromnvalue(#IHIVCN) persistent(False) #avFrameworkManager.avSwitch caller(#COM_OWNER) toobjectnamed(CMG_TIME_CARDS) endroutine
Code: Select all
mthroutine name(uInitialize) options(*REDEFINE) * Do any initialization defined in the ancestor #COM_ANCESTOR.uInitialize #COM_OWNER.avFilterLocation := LEFT #COM_OWNER.avAllowLocationChange := True #wk_CountryCode := 1 #avFrameworkManager.avRestoreValue withid1(CMG) withid2(INVOICE_NUMBER) tonvalue(#TIIVCN) #avFrameworkManager.avRecordTraceAValue component(#COM_OWNER) event("Restore Value from Clipboard") avalue(#TIIVCN.AsString) if (#TIIVCN <> 0) #COM_OWNER.Search endif
So apparently my solution does not work when the other object is already open.
Also I can't seem to get the #avFrameworkManager.avClipBoardChanged event to fire, or at least it is not getting picked up in the Time Cards object.