{"title":"Codeunit 30316 Shpfy Metafield API, extension points 29","url":"https://jonas-paprotka.de/ref/codeunit/30316-shpfy-metafield-api/points/","author":"JOP-AL","license":"Metadata from Microsoft's symbol packages. AL source MIT, Copyright (c) Microsoft Corporation. Selection and wording © 2026 JOP-AL. https://jonas-paprotka.de/licenses/","subject":"Microsoft Dynamics 365 Business Central","checked":"2026-11-20","changed":"2026-10-05","object":{"type":"codeunit","id":30316,"name":"Shpfy Metafield API","app":"Shopify Connector","url":"https://jonas-paprotka.de/ref/codeunit/30316-shpfy-metafield-api/"},"major":29,"source":{"url":"https://jonas-paprotka.de/ref/codeunit/30316-shpfy-metafield-api/source/","path":"src/Apps/W1/Shopify/App/src/Metafields/Codeunits/ShpfyMetafieldAPI.Codeunit.al","commit":"4303e5e584d3aa5d9e98cbc615525a5396ad6ed7","lines":"a line is <source url>#L<line>"},"steps":{"event":"[line, \"event\", name, handled]: raises an event of this object; handled 1 when it has an IsHandled parameter","call":"[line, \"call\", name, arguments]: calls a procedure of this object","ext":"[line, \"ext\", type, id, name, arguments]: calls a procedure of another object, through a variable declared with that type","write":"[line, \"write\", table id, method, 1 when called with true]: Insert, Modify, ModifyAll, Delete, DeleteAll or Rename","validate":"[line, \"validate\", table id, field name]","run":"[line, \"run\", type, id]: Codeunit.Run, Page.Run, Report.Run and their kin"},"objects":{"codeunit:30103":{"name":"Shpfy Communication Mgt.","url":"https://jonas-paprotka.de/ref/codeunit/30103-shpfy-communication-mgt/"},"codeunit:30157":{"name":"Shpfy Json Helper","url":"https://jonas-paprotka.de/ref/codeunit/30157-shpfy-json-helper/"},"table:30101":{"name":"Shpfy Metafield","url":"https://jonas-paprotka.de/ref/table/30101-shpfy-metafield/"}},"procs":[{"name":"SetShop","line":18,"kind":"procedure","access":"internal","params":1,"steps":[[21,"ext","codeunit",30103,"SetShop",1]]},{"name":"SyncMetafieldToShopify","line":31,"kind":"procedure","access":"internal","params":2,"steps":[[40,"call","SetShop",1],[41,"call","CreateMetafieldQuery",2],[42,"call","UpdateMetafields",1],[44,"ext","codeunit",30157,"GetJsonArray",3],[47,"ext","codeunit",30157,"GetJsonArray",3],[49,"ext","codeunit",30157,"GetValueAsBigInteger",2]]},{"name":"SyncMetafieldsToShopify","line":54,"kind":"procedure","access":"internal","params":3,"steps":[[56,"call","SetShop",1],[57,"call","CreateOrUpdateMetafieldsInShopify",2]]},{"name":"CreateOrUpdateMetafieldsInShopify","line":69,"kind":"procedure","access":"internal","params":2,"steps":[[77,"call","RetrieveMetafieldsFromShopify",2],[78,"call","CollectMetafieldsInBC",4],[89,"call","GetMaxMetafieldsToUpdate",0],[95,"call","CreateMetafieldQuery",2],[99,"call","UpdateMetafields",1]]},{"name":"RetrieveMetafieldsFromShopify","line":108,"kind":"procedure","access":"local","params":2,"steps":[[113,"ext","table",30101,"GetOwnerType",1]]},{"name":"CollectMetafieldsInBC","line":117,"kind":"procedure","access":"local","params":4,"steps":[[131,"write",30101,"Insert"],[135,"write",30101,"Insert"]]},{"name":"UpdateMetafields","line":144,"kind":"procedure","access":"internal","params":1,"steps":[[149,"ext","codeunit",30103,"ExecuteGraphQL",2]]},{"name":"CreateMetafieldQuery","line":157,"kind":"procedure","access":"internal","params":2,"steps":[[167,"ext","table",30101,"GetOwnerTypeName",0],[172,"ext","codeunit",30103,"EscapeGraphQLData",1],[175,"call","GetTypeName",1]]},{"name":"UpdateMetafieldsFromShopify","line":197,"kind":"procedure","access":"internal","params":3,"steps":[[204,"call","CollectMetafieldIds",3],[207,"ext","codeunit",30157,"GetJsonObject",3],[208,"call","UpdateMetadataField",3],[212,"call","DeleteUnusedMetafields",1]]},{"name":"GetMetafieldDefinitions","line":215,"kind":"procedure","access":"internal","params":3,"steps":[[217,"call","SetShop",1]]},{"name":"GetMetafieldDefinitions","line":230,"kind":"procedure","access":"local","params":2,"steps":[[240,"ext","table",30101,"GetOwnerType",1],[242,"ext","codeunit",30103,"ExecuteGraphQL",2],[244,"ext","codeunit",30157,"GetJsonArray",3],[246,"ext","codeunit",30157,"GetJsonObject",3],[247,"call","CreateMetafieldDefinition",3]]},{"name":"CreateMetafieldDefinition","line":251,"kind":"procedure","access":"local","params":3,"steps":[[259,"ext","codeunit",30157,"GetValueAsText",2],[260,"ext","codeunit",30157,"GetValueAsText",2],[261,"ext","codeunit",30157,"GetValueAsText",2],[264,"call","ConvertToMetafieldType",2],[275,"validate",30101,"Parent Table No."],[277,"ext","codeunit",30157,"GetValueAsBigInteger",2],[283,"write",30101,"Insert",1]]},{"name":"UpdateMetadataField","line":286,"kind":"procedure","access":"local","params":3,"steps":[[294,"ext","codeunit",30157,"GetValueAsText",2],[299,"call","ConvertToMetafieldType",2],[299,"ext","codeunit",30157,"GetValueAsText",2],[302,"validate",30101,"Parent Table No."],[304,"ext","codeunit",30157,"GetValueAsBigInteger",2],[307,"ext","codeunit",30157,"GetValueAsText",2],[308,"ext","codeunit",30157,"GetValueAsText",2],[311,"write",30101,"Modify"],[312,"write",30101,"Insert"]]},{"name":"DeleteUnusedMetafields","line":341,"kind":"procedure","access":"local","params":1,"steps":[[348,"write",30101,"Delete"]]}]}