{"id":281,"date":"2012-07-26T09:31:23","date_gmt":"2012-07-26T09:31:23","guid":{"rendered":"http:\/\/foxware.co.uk\/?p=281"},"modified":"2012-07-26T09:31:23","modified_gmt":"2012-07-26T09:31:23","slug":"ax-bc-update-a-record","status":"publish","type":"post","link":"http:\/\/foxware.co.uk\/?p=281","title":{"rendered":"AX BC- Update a Record"},"content":{"rendered":"<pre class=\"lang:c# decode:true\" >\r\n\r\n\r\ntry\r\n{\r\n    \/\/ Create an Axapta record for the StateAddress table.\r\n    DynRec = DynAx.CreateAxaptaRecord(\"APMObjectTable\");\r\n\r\n    \/\/ Execute a query to retrieve an editable record where the name is MyState.\r\n    DynRec.ExecuteStmt(\"select forupdate * from %1 where %1.APMObjectId == 'HLH000001'\");\r\n\r\n    \/\/ If the record is found then update the name.\r\n    if (DynRec.Found)\r\n    {\r\n        \/\/ Start a transaction that can be committed.\r\n        DynAx.TTSBegin();\r\n        string _text = @\"\";\r\n        _text += \"Line One\\n\";\r\n        _text += \"Line Two\\n\";\r\n        _text += \"Line Three\\n\";\r\n        _text += \"Line Four\\n\";\r\n\r\n        DynRec.set_Field(\"APMObjectDescription\", _text);\r\n        DynRec.Update();\r\n\r\n        \/\/ Commit the transaction.\r\n        DynAx.TTSCommit();\r\n    }\r\n}\r\ncatch (Exception ex)\r\n{\r\n    MessageBox.Show(ex.Message, \"Don't Panic!\");\r\n}\r\n\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>try { \/\/ Create an Axapta record for the StateAddress table. DynRec = DynAx.CreateAxaptaRecord(&#8220;APMObjectTable&#8221;); \/\/ Execute a query to retrieve an editable record where the name is MyState. DynRec.ExecuteStmt(&#8220;select forupdate * from %1 where %1.APMObjectId == &#8216;HLH000001&#8242;&#8221;); \/\/ If the &hellip; <a href=\"http:\/\/foxware.co.uk\/?p=281\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"http:\/\/foxware.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/281"}],"collection":[{"href":"http:\/\/foxware.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/foxware.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/foxware.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/foxware.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=281"}],"version-history":[{"count":1,"href":"http:\/\/foxware.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/281\/revisions"}],"predecessor-version":[{"id":282,"href":"http:\/\/foxware.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/281\/revisions\/282"}],"wp:attachment":[{"href":"http:\/\/foxware.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/foxware.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=281"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/foxware.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}