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

  • 相关阅读:
    Strust2学习笔记
    EL与OGNL区别
    十进制与其他进制转换
    JSTL
    <jsp:include>和<%@include%>区别
    AngularJS 内置过滤器
    ubuntu下swift安装
    ubuntu下gerrit 安装部署
    java日期操作
    SpringMVC GET请求中文数据传递到Server端乱码
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1940470.html
Copyright © 2011-2022 走看看