zoukankan      html  css  js  c++  java
  • To Find or Update customer primary Address in Ax 2012

    To Find or Update customer primary Address in Ax 2012 you can try following code. Relation between dirpartytable and custtable slightly changed in Ax 2012 so you need to re-learn about this.

    static void jay_updateAddress(Args _args) {    

    container                   roles;    

    DirParty                    dirParty;    

    DirPartyPostalAddressView   addressView;    

    LogisticsPostalAddress      address;    

    CustTable                   custtable;            

    DirPartyLocation partyLocation;

        ;    

    ttsBegin;    

    custtable = Custtable::find("Cust-000025");           

    address = DirParty::primaryPostalAddress(CustTable.Party);   //找到主要地址    

    address = DirParty::findPostalAddressByRole(CustTable.Party, LogisticsLocationRoleType::Business);

       

    /* 找到第一个地址, 并将第一个地址更新为主要地址    

    select firstonly address join forupdate partyLocation                        

    where partyLocation.Location == address.Location            

    && partyLocation.Party == CustTable.Party;    

    partyLocation.IsPrimary = NoYes::Yes;    

    partyLocation.update();    

    */        

    address.City    = "沧州";    

    address.State   = "河北省";    

    addressView.IsPrimary = NoYes::Yes; // this line is valid when update

    addressView.Party = CustTable.Party;    

    addressview.initFromPostalAddress(address);    

    DirParty = DirParty::constructFromPartyRecId(CustTable.Party);    

    roles = [LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Business).RecId]; // 地址类型    

    DirParty.createOrUpdatePostalAddress(addressView,roles);            

    ttsCommit;        

    info("xixi");    

    }

    Note: createOrUpdatePostalAddress method is useful for both creating or updating the customer address. if you are providing the existing dirpartyid then it will update the customer address ,in case of new dirpartyid it will create a new address.

  • 相关阅读:
    apiAutoTest:基于mitmproxy实现接口录制
    FastAPI + Vue 前后端分离 接口自动化测试工具 apiAutoTestWeb
    FastAPI项目实战:"异步"接口测试"平台"
    apiAutoTest:自动化测试用例中调用自定义函数的实现
    测试笔记01-Git
    C++:常量
    C++: 变量类型
    C++:数据类型
    C++:第一个c++程序
    mitrproxy抓包微信小程序
  • 原文地址:https://www.cnblogs.com/xiangliqi/p/4609892.html
Copyright © 2011-2022 走看看