Description:-
Unfortunately there really isn't one "last used printer"
stored, as much as each process packs and stores the last used print settings.
Here is an example of how you can pull the last used print settings after
posting a picking slip from the sales form.
Code:-
static void JobGetPrinterSettingsPickList(Args _args) { container lastValues; SalesFormLetter_PickingList pickList = new SalesFormLetter_PickingList(); SRSPrintDestinationSettings printSettings; lastValues = xSysLastValue::getValue(curext(), curUserId(), UtilElementType::Class, classStr(SalesFormLetter_PickingList),formStr(SalesTable)); pickList.unpack(lastValues); printSettings = new SRSPrintDestinationSettings(pickList.printerSettingsFormletter()); info(strFmt("%1", printSettings.printerName())); info(strFmt("%1", printSettings.printerType())); }
Edit: Ah I see you're having a specific issue. Check the pack/unpack and
version of whatever object is having the issue. That is likely where the issue
is. Or if it's on several things, check if they're all extended classes and you
need to look at the parent class.
select * fromSysLastValue whereuserid in ( select id fromuserinfo wherenetworkalias in ('userid1','userid2') ) andelementname like '%print%' andiskernel = 1
However so far I've not been able to guess
which setting holds the last used printer information. Since the value field is
of type image (i.e. a blob) I also can't search based on value.
Thanks for comments.....