zoukankan      html  css  js  c++  java
  • Using x++ code updated to system filed values

    The following X++ code using to update system field values.
    Wrote by Jimmy Jan 20th 2011

    1)Add  the Static method(UpdateupdateSystemFieldValues) to the global class.

    static server void updateSystemFieldValues(common    _common,
                                               int       _systemFieldNum,
                                               anytype   _fieldvalue)
    {
        Dictfield   _dictField    =   new Dictfield(_common.TableId,_systemFieldNum);
    ;
        if  (!_dictField)
            return;
        
        if  (_dictField.isSystem())
        {
            new OverwriteSystemfieldsPermission().assert();
            _common.overwriteSystemfields(true);
            _common.(_systemFieldNum) =   _fieldValue;
            CodeAccessPermission::revertAssert();
            _common.overwriteSystemfields(false);
        }
        else
        {
            _common.(_systemFieldNum) =   _fieldValue;
        }
    }
    
    
    


    2)Job invoking the global static method updateSystemFieldValues

    static void Jimmy_UpdateupdateSystemFieldValues(Args _args)
    {
        salesTable   salesTable;
        ;
        ttsbegin;
        select firstonly forupdate salesTable
            where salesTable.createdBy == "tyler";
        if(salesTable)
        {
            info(strfmt("%1 - %2 - %3",salesTable.SalesId,salesTable.createdBy,salesTable.RecId));
    
            global::UpdateupdateSystemFieldValues(salesTable,fieldnum(SalesTable,createdby),"Jimmy");
            salesTable.update();
        }
        ttscommit;
    }
    
    

  • 相关阅读:
    ubuntu的apt
    sudo命令
    MySQL导出数据到csv文件
    MySQL导出数据到文件报错
    git_backup.py gitlab项目备份
    java中图像与数组转换
    mongodb转elasticsearch
    impyla-0.14.2.2安装注意事项
    python3.7.3升级 with-openssl openssl-1.0.2a
    hadoop自带性能测试
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1940470.html
Copyright © 2011-2022 走看看