شعار Bc Field Propagation

Bc Field Propagation

المجتمع
fernandoartalf
bc-field-propagation

نقل الحقول المخصّصة من مستندات المصدر وسطوره اليومية إلى المستندات المُرحّلة والمستندات المؤرشفة وقيود دفتر الأستاذ في Business Central. يختار بين النمط A (TransferFields — بلا تعليمات برمجية، مع استخدام معرّف Field نفسه في جميع امتدادات الجداول) والنمط B (EventSubscriber مع وحدة codeunit مخصّصة لكل وحدة) بحسب استخدام وحدة codeunit الخاصة بالترحيل لـ TransferFields. استخدمه عند طلب إضافة حقل إلى مستندات المبيعات/المشتريات/التحويل، على أن يظهر في الفواتير المُرحّلة أو الشحنات أو الإشعارات الدائنة أو الأرشيفات؛ أو عند نقل الحقول من Item Journal Line إلى Item Ledger Entry أو Capacity Ledger Entry؛ أو عند نسخ الحقول من Gen. Journal Line إلى Cust./Vendor/G/L Ledger Entry؛ أو عند توسيع أي سلسلة ترحيل في BC ببيانات مخصّصة. تشمل عبارات التشغيل: "add field to posted document" و"copy field from header to invoice" و"propagate field to ledger entry" و"field propagation" و"TransferFields custom field" و"posting chain field extension".

نظرة عامة

الناشرfernandoartalf
المستودعAL-Copilot-Skills-Collection
اسم المهارةbc-field-propagation
النجوم
28
التفريعات
8
الملفات المرفقة
5
الترخيصMIT
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 5

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها fernandoartalf على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Bc Field Propagation في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/fernandoartalf/AL-Copilot-Skills-Collection/tree/main/skills/bc-field-propagation
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/fernandoartalf/AL-Copilot-Skills-Collection.git /tmp/AL-Copilot-Skills-Collection
mkdir -p .claude/skills
cp -r /tmp/AL-Copilot-Skills-Collection/skills/bc-field-propagation .claude/skills/bc-field-propagation
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Bc Field Propagation في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Bc Field Propagation تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Bc Field Propagation بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

Business Central Field Propagation

Propagates custom fields from source documents and journal lines to posted/archived documents and ledger entries. Selects Pattern A (TransferFields — zero code) or Pattern B (EventSubscriber with dedicated codeunit) based on whether the posting codeunit calls TransferFields.


Scope

In scope:

  • Sales, Purchase, Transfer header and line documents → posted, archive, and return documents
  • Item Journal Line → Item Ledger Entry, Capacity Ledger Entry, Value Entry
  • Gen. Journal Line → Cust. Ledger Entry, Vendor Ledger Entry, G/L Entry
  • Resource Journal Line → Res. Ledger Entry
  • Cash Flow Worksheet Line → Cash Flow Forecast Entry
  • Routing Line → Prod. Order Routing Line
  • Assembly Header/Line → Posted Assembly Header/Line
  • Warehouse Receipt/Shipment Line → Posted Receipt/Shipment Line
  • Any other posting chain where a BC-published integration event is available

Out of scope:

  • FlowFields and FlowFilters (they are computed, not transferred)
  • Fields populated after posting by background jobs or codeunit chains not reachable via a published event
  • Creating new source or target tables from scratch (use bc-setup-table-generator for that)

Input

Collect this information before generating code:

#ItemExample
1Source table name and IDItem Journal Line (83)
2Field ID50100
3Field nameMyCustomField
4Field typeText[50]
5Caption (English)My Custom Field
6Target tablesItem Ledger Entry, Capacity Ledger Entry
7Module / feature nameItemCostAllocation

Decision Tree — Which Pattern?

Open the posting codeunit for the source table.
Search for TransferFields(SourceRecord) where SourceRecord is a variable of the source table type.

Found? ─── YES ──► Pattern A (TransferFields)
                    Add field (same ID) to source + all target TableExts.
                    No subscriber needed.

Not found? ─ NO ──► Pattern B (EventSubscriber)
                    Add field (same ID) to source + all target TableExts.
                    Create one dedicated EventSubscriber codeunit per module.
                    Read references/pattern-b-event-map.md NOW to pick the event.

Read references/pattern-a-table-map.md NOW for all Pattern A source→target mappings. Read references/pattern-b-event-map.md NOW for all Pattern B events and codeunit IDs.


Quick Start — Pattern A

No subscriber code required. Add the field with the same Field ID to every table extension in the posting chain.

al
// Source
tableextension 50100 "Sales Header Ext." extends "Sales Header"
{
    fields
    {
        field(50100; MyCustomField; Text[50])
        {
            Caption = 'My Custom Field';
            DataClassification = CustomerContent;
        }
    }
}

// Each posted target — same Field ID, same name, same type
tableextension 50101 "Sales Invoice Header Ext." extends "Sales Invoice Header"
{
    fields
    {
        field(50100; MyCustomField; Text[50])
        {
            Caption = 'My Custom Field';
            DataClassification = CustomerContent;
        }
    }
}

// Repeat for Sales Shipment Header, Sales Cr.Memo Header, Return Receipt Header,
// Sales Header Archive — all using field ID 50100.

Quick Start — Pattern B

Requires three artifacts: source TableExt, target TableExt(s), and one dedicated EventSubscriber codeunit.

al
// 1. Source TableExt
tableextension 50110 "Item Journal Line Ext." extends "Item Journal Line"
{
    fields
    {
        field(50100; MyCustomField; Text[50])
        {
            Caption = 'My Custom Field';
            DataClassification = CustomerContent;
        }
    }
}

// 2. Target TableExt — same Field ID
tableextension 50111 "Item Ledger Entry Ext." extends "Item Ledger Entry"
{
    fields
    {
        field(50100; MyCustomField; Text[50])
        {
            Caption = 'My Custom Field';
            DataClassification = CustomerContent;
        }
    }
}

// 3. Dedicated subscriber codeunit (one per module / posting chain)
codeunit 50120 "Ev Item Jnl Post [ModuleName]"
{
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Jnl.-Post Line",
        'OnBeforeInsertItemLedgEntry', '', false, false)]
    local procedure CopyFieldToItemLedgEntry(var ItemLedgerEntry: Record "Item Ledger Entry";
        ItemJournalLine: Record "Item Journal Line")
    begin
        ItemLedgerEntry.MyCustomField := ItemJournalLine.MyCustomField;
    end;
}

Workflow

Step 1 — Determine pattern

Open the posting codeunit for the source table. Search for TransferFields. Choose Pattern A or Pattern B.

Step 2 — Collect field metadata

Confirm Field ID, name, type, and caption. The same ID must be used on every table extension.

Read references/pattern-a-table-map.md NOW if Pattern A. Read references/pattern-b-event-map.md NOW if Pattern B.

Step 3 — Create source TableExt

Add the field to the source table extension. Set DataClassification. Add Caption in English.

Step 4 — Create target TableExt(s)

Create one TableExt per target table with the same Field ID, name, and type. If the target is a ledger or posted table, set Editable = false if the field must be read-only after posting.

Step 5 — Create subscriber codeunit (Pattern B only)

Create one codeunit per module. Subscribe to the correct event from references/pattern-b-event-map.md. Copy the field value inside the subscriber. Do not mix different posting chains in the same codeunit.

Step 6 — Verify and check

Run the pre-commit checklist at references/field-propagation-checklist.md. Test a real posting and confirm the field value propagates.


Rule 1 — Field Identity

The Field ID, field name, data type, and length must be identical on the source TableExt and every target TableExt. Deviation causes data inconsistency and breaks future migration to Pattern A.

al
// Correct — same ID 50100 on all extensions
field(50100; MyCustomField; Text[50]) // source
field(50100; MyCustomField; Text[50]) // target 1
field(50100; MyCustomField; Text[50]) // target 2

// Wrong — different IDs
field(50100; MyCustomField; Text[50]) // source
field(50200; MyCustomField; Text[50]) // target — ID mismatch

Rule 2 — Pattern A: verify TransferFields, delete redundant subscribers

Before implementing Pattern A, confirm the posting codeunit calls TransferFields. If you find an existing EventSubscriber that already copies the same field, delete the subscriber — it is redundant and must not coexist with TransferFields for the same field.

al
// In BC posting codeunit (simplified):
SalesInvoiceHeader.TransferFields(SalesHeader); // ← Pattern A confirmed
SalesInvoiceHeader.Insert(true);

Rule 3 — Pattern B: one dedicated codeunit per posting chain per module

Do not put subscribers for different posting chains in the same codeunit. Do not scatter one posting chain's subscribers across multiple codeunits. One codeunit = one posting chain + one module/feature.

al
// Correct: dedicated codeunit for Item Journal Line posting in MyModule
codeunit 50120 "Ev Item Jnl Post MyModule"
{
    // All subscribers for Item Journal Line → posted targets for MyModule go here
}

// Wrong: mixed chains in one codeunit
codeunit 50120 "Ev Post MyModule"
{
    // Item Journal subscriber ...
    // Gen. Journal subscriber ...   ← wrong, different chain
}

Rule 4 — Event Selection for Pattern B

Read references/pattern-b-event-map.md NOW before writing any subscriber.

Use the event from the map. Do not use OnAfterInsert directly on the target table — BC may call Insert multiple times (e.g., on preview or partial posting). Prefer the posting-codeunit-published event which fires exactly once per document line.


Rule 5 — DataClassification

Set DataClassification on every field in every TableExt. Use CustomerContent for fields that hold user-entered business data. Never leave it unset.

al
field(50100; MyCustomField; Text[50])
{
    Caption = 'My Custom Field';
    DataClassification = CustomerContent;
}

Rule 6 — Editable on posted tables

Posted and ledger entry tables must have Editable = false on custom fields that should not be changed after posting.

al
// Target: Sales Invoice Header TableExt
field(50100; MyCustomField; Text[50])
{
    Caption = 'My Custom Field';
    DataClassification = CustomerContent;
    Editable = false;
}

Rule 7 — FlowFields do not transfer

TransferFields does not transfer FlowField values. If you need a computed total on the posted document, define a FlowField on the target TableExt with its own CalcFormula, or call CalcFields explicitly where the value is displayed.

al
// FlowField on posted table — not transferred, self-computed
field(50101; RelatedCount; Integer)
{
    Caption = 'Related Count';
    FieldClass = FlowField;
    CalcFormula = Count("My Related Table" WHERE("Document No." = FIELD("No.")));
    Editable = false;
}

Known Limitations

  • Modify(false) in subscribers: Some BC events pass the target record by var but the posting codeunit calls Insert internally after the event. Assigning the field inside the event IS persisted because it modifies the in-memory record before Insert. However, if the posting code calls Modify(false) or skips Modify later, a second assignment inside an OnAfterModify event on the target table is needed.
  • Ledger entries created multiple times: Some posting chains (e.g., partial shipment + invoice) insert the target record more than once. The subscriber fires for each insert — ensure the source record is always accessible in the event parameters.
  • Resource Ledger Entry: If OnAfterInsertResLedgEntry is not exposed in your BC version, use OnBeforeInsertResLedgEntry or a wrapper integration event.
  • FlowFields on source are not copied: Pattern A's TransferFields copies stored fields only. FlowFields on the source table are skipped.

Anti-Patterns

Anti-PatternWhy It Is WrongCorrect Approach
Manual field copy subscriber when posting codeunit uses TransferFieldsRedundant — TransferFields already copies the value. Double-assignment, extra maintenance.Delete the subscriber. Rely on Pattern A.
One subscriber codeunit mixing multiple posting chainsHard to maintain, causes unclear responsibility boundaries.One codeunit per posting chain per module.
Different Field IDs on source and targetBreaks Pattern A migration path; causes data auditing issues.Always use the same Field ID.
Using OnAfterInsert on target table instead of posting codeunit eventOnAfterInsert fires for all inserts (UI, copy, import) — not only posting.Use the posting-codeunit-published event.
Missing Editable = false on posted tablesUsers can modify posted data, bypassing posting logic.Set Editable = false on all posted/ledger target fields.

Before Committing

Run references/field-propagation-checklist.md in full before every commit.

Key gates:

  1. Same Field ID on source and ALL target TableExts.
  2. No redundant subscriber when Pattern A applies.
  3. Dedicated subscriber codeunit per posting chain per module.
  4. DataClassification set on every field.
  5. Editable = false on all posted/ledger target fields.
  6. Test posting confirms field value propagates end-to-end.

Behaviour Rules

  1. Always decide pattern first. Do not write code until you have opened the posting codeunit and confirmed whether TransferFields is called. Pattern selection is irreversible in a clean architecture.
  2. Same Field ID everywhere. Never generate a target TableExt with a Field ID different from the source. Reject the request and ask for clarification if the user provides inconsistent IDs.
  3. Read the event map before any subscriber. Always read references/pattern-b-event-map.md before writing Pattern B code. Do not guess the event name.
  4. One codeunit per posting chain per module. Never merge subscribers from different posting chains. Never split one posting chain's subscribers across two codeunits.
  5. Detect and flag redundant subscribers. If an existing subscriber manually copies a field that TransferFields already handles, flag it as an anti-pattern and recommend deletion.
  6. Never use OnAfterInsert on target tables as a substitute for a posting codeunit event. Always prefer the integration event published by the posting codeunit.
  7. Run the checklist. Always output the checklist path (references/field-propagation-checklist.md) at the end of the implementation as a reminder to run it before committing.

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة ما دامت المهارة محمّلة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Bc Field Propagation؟

نقل الحقول المخصّصة من مستندات المصدر وسطوره اليومية إلى المستندات المُرحّلة والمستندات المؤرشفة وقيود دفتر الأستاذ في Business Central. يختار بين النمط A (TransferFields — بلا تعليمات برمجية، مع استخدام معرّف Field نفسه في جميع امتدادات الجداول) والنمط B (EventSubscriber مع وحدة codeunit مخصّصة لكل وحدة) بحسب استخدام وحدة codeunit الخاصة بالترحيل لـ TransferFields. استخدمه عند طلب إضافة حقل إلى مستندات المبيعات/المشتريات/التحويل، على أن يظهر في الفواتير المُرحّلة أو الشحنات أو الإشعارات الدائنة أو الأرشيفات؛ أو عند نقل الحقول من Item Journal Line إلى Item Ledger Entry أو Capacity Ledger En...

لماذا تستخدم Bc Field Propagation على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Bc Field Propagation عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Bc Field Propagation في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/fernandoartalf/AL-Copilot-Skills-Collection/tree/main/skills/bc-field-propagation. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Bc Field Propagation؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Bc Field Propagation؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Bc Field Propagation معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Bc Field Propagation مجانية؟

نعم. نشرها fernandoartalf على GitHub بموجب ترخيص MIT. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇