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;
    }
    
    

  • 相关阅读:
    composer的使用
    tp5短信接口的使用
    PHP序列化与反序列化
    PHP 的oop思想
    php单例模式
    统计图的使用(chart)
    jq的时间插件
    php中Excel操作
    Linux 常用命令
    think cmfx目录结构
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1940470.html
Copyright © 2011-2022 走看看