How do you find a user's last used printer in SysLastValue

戏子无情 提交于 2019-12-04 18:20:00

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!