{"action":"opened","issue":{"url":"https://api.github.com/repos/Microsoft/ALAppExtensions/issues/571","repository_url":"https://api.github.com/repos/Microsoft/ALAppExtensions","labels_url":"https://api.github.com/repos/Microsoft/ALAppExtensions/issues/571/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/ALAppExtensions/issues/571/comments","events_url":"https://api.github.com/repos/Microsoft/ALAppExtensions/issues/571/events","html_url":"https://github.com/Microsoft/ALAppExtensions/issues/571","id":388692829,"node_id":"MDU6SXNzdWUzODg2OTI4Mjk=","number":571,"title":"[Event Request] Codeunit 5063 - ArchiveManagement - OnBeforePurchLineArchiveInsert","user":{"login":"rvanbekkum","id":7383241,"node_id":"MDQ6VXNlcjczODMyNDE=","avatar_url":"https://avatars3.githubusercontent.com/u/7383241?v=4","gravatar_id":"","url":"https://api.github.com/users/rvanbekkum","html_url":"https://github.com/rvanbekkum","followers_url":"https://api.github.com/users/rvanbekkum/followers","following_url":"https://api.github.com/users/rvanbekkum/following{/other_user}","gists_url":"https://api.github.com/users/rvanbekkum/gists{/gist_id}","starred_url":"https://api.github.com/users/rvanbekkum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvanbekkum/subscriptions","organizations_url":"https://api.github.com/users/rvanbekkum/orgs","repos_url":"https://api.github.com/users/rvanbekkum/repos","events_url":"https://api.github.com/users/rvanbekkum/events{/privacy}","received_events_url":"https://api.github.com/users/rvanbekkum/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-07T15:09:42Z","updated_at":"2018-12-07T15:09:42Z","closed_at":null,"author_association":"NONE","body":"Dear dev. team,\r\n\r\nWe would like to request the following event-publisher in codeunit 5063 ArchiveManagement, that should be called from the StorePurchDocument function:\r\n\r\n```pascal\r\n[External] StorePurchDocument(VAR PurchHeader : Record \"Purchase Header\";InteractionExist : Boolean)\r\nPurchHeaderArchive.INIT;\r\nPurchHeaderArchive.TRANSFERFIELDS(PurchHeader);\r\nPurchHeaderArchive.\"Archived By\" := USERID;\r\nPurchHeaderArchive.\"Date Archived\" := WORKDATE;\r\nPurchHeaderArchive.\"Time Archived\" := TIME;\r\nPurchHeaderArchive.\"Version No.\" := GetNextVersionNo(\r\n    DATABASE::\"Purchase Header\",PurchHeader.\"Document Type\",PurchHeader.\"No.\",PurchHeader.\"Doc. No. Occurrence\");\r\nPurchHeaderArchive.\"Interaction Exist\" := InteractionExist;\r\nRecordLinkManagement.CopyLinks(PurchHeader,PurchHeaderArchive);\r\nOnBeforePurchHeaderArchiveInsert(PurchHeaderArchive,PurchHeader);\r\nPurchHeaderArchive.INSERT;\r\nOnAfterPurchHeaderArchiveInsert(PurchHeaderArchive,PurchHeader);\r\n\r\nStorePurchDocumentComments(\r\n  PurchHeader.\"Document Type\",PurchHeader.\"No.\",\r\n  PurchHeader.\"Doc. No. Occurrence\",PurchHeaderArchive.\"Version No.\");\r\n\r\nPurchLine.SETRANGE(\"Document Type\",PurchHeader.\"Document Type\");\r\nPurchLine.SETRANGE(\"Document No.\",PurchHeader.\"No.\");\r\nIF PurchLine.FINDSET THEN\r\n  REPEAT\r\n    WITH PurchLineArchive DO BEGIN\r\n      INIT;\r\n      TRANSFERFIELDS(PurchLine);\r\n      \"Doc. No. Occurrence\" := PurchHeader.\"Doc. No. Occurrence\";\r\n      \"Version No.\" := PurchHeaderArchive.\"Version No.\";\r\n      RecordLinkManagement.CopyLinks(PurchLine,PurchLineArchive);\r\n      OnBeforePurchLineArchiveInsert(PurchLineArchive, PurchLine); // ** New event\r\n      INSERT;\r\n    END;\r\n    IF PurchLine.\"Deferral Code\" <> '' THEN\r\n      StoreDeferrals(DeferralUtilities.GetPurchDeferralDocType,PurchLine.\"Document Type\",\r\n        PurchLine.\"Document No.\",PurchLine.\"Line No.\",PurchHeader.\"Doc. No. Occurrence\",PurchHeaderArchive.\"Version No.\");\r\n\r\n    OnAfterStorePurchLineArchive(PurchHeader,PurchLine,PurchHeaderArchive,PurchLineArchive);\r\n  UNTIL PurchLine.NEXT = 0;\r\n```\r\n\r\nThe signature for this event-publisher would be as follows:\r\n\r\n```pascal\r\nLOCAL [IntegrationEvent] OnBeforePurchLineArchiveInsert(VAR PurchLineArchive : Record \"Purchase Line Archive\";PurchLine : Record \"Purchase Line\")\r\n```"}}
{"actor":{"display_login":"rvanbekkum"}}