共用方式為


新式命令的範圍

命令具有三個範圍之一。 範圍會確定命令 (schemaname = appaction) 是否將為單個應用程式內的資料表、跨所有應用程式的資料表或所有資料表和所有應用程式呈現。

命令必須繫結至命令列位置,例如主要格線或主要資料表單,而不考慮範圍。 因此,變更範圍並不會在不同的命令列位置 (例如主要格線和主要資料表單) 中呈現命令。

  • 應用程式這是使用新式命令設計工具建立或編輯命令時,最少的範圍和預設行為。 命令設計工具會在模型導向應用程式、資料表和命令列位置的內容中打開。
  • 資料表也稱為實體範圍。 繫結至特定資料表和命令列位置。 不會繫結至任何特定應用程式。 因此,資料表範圍的命令將在所有使用該資料表的應用程式中呈現。 例如,當查看客戶記錄的主要資料表單時,帳戶資料表和主要資料表單位置的資料表範圍命令將會出現在所有應用程式中。
  • 全域這是最廣泛的範圍。 全域範圍命令只會繫結至命令列位置,而不是應用程式或資料表。 例如,當查看每個資料表的主要資料表單時,主要資料表單位置的全域範圍命令將會出現在環境中的所有應用程式中。

重要

在這段時間,針對動作和/或可見度使用 Power Fx 的命令無法轉換成資料表或全域範圍。

當命令嵌套在下拉式清單、群組和分割按鈕中時,所有命令都必須設為相同的範圍。

如果在新式命令設計工具中編輯全域或資料表範圍命令,則會建立一個應用程式範圍的複本 (執行個體),並連結至原始命令。 例如,在命令設計工具中編輯全域範圍命令時,會覆寫原始的全域範圍命令,但只適用於打開命令設計工具時所選取的特定應用程式和資料表。 所有其他的應用程式和資料表都會呈現原始命令。 複本 (執行個體) 現已擁有自己的生命週期。 對原始全域範圍命令所做的變更不會影響新的應用程式範圍執行個體,反之亦然。

覆寫資料表與全域範圍的命令

更窄的範圍可在每個層級覆寫更廣泛的範圍命令。 範圍最窄的獲勝。

  • 資料表 (實體) 範圍命令會覆寫全域範圍的命令。 您可以定義一個在所有資料表中都相同的命令,但只會修改特定資料表的行為。
  • 應用程式範圍命令會覆寫所有其他範圍,但只適用於特定應用程式和資料表。

如何建立資料表範圍命令

  1. 使用命令設計工具在您的解決方案中建立一或多個命令。 或者,建立單獨的解決方案,並選取新增現有的 > 資料表

  2. 選擇選取物件,然後新增所需的命令。

  3. 選取匯出以匯出您的解決方案。

    匯出解決方案。

  4. 如果您最近有進行變更但尚未發佈,請選取發佈。 然後選取執行,檢查解決方案是否有任何問題或相依性,然後選取下一步

  5. 選取未受管理選項,然後選取匯出

  6. 下載對話方塊中選取儲存,然後在下載完成對話方塊內選取開啟資料夾

  7. 在下載的壓縮 .zip 檔案上按一下右鍵以選取,然後選取解壓縮全部

  8. 選取要將檔案解壓縮的位置,然後選取解壓縮

  9. 打開解壓縮檔案的資料夾,打開 appaction.xml 檔案,然後尋找所需的命令 (appaction)。

  10. 從 xml 中刪除 appmoduleid 節點。

     <appmoduleid>
       <uniquename>demo_DemoFestApp</uniquename>
     </appmoduleid>
    
  11. 變更 appaction uniquename 的值。 變更最後一個字元中的任何一個就可以了 (例如從 1 到 2),或者如果需要的話,您也可以使用更具描述性的命名規則。

範例 XML。

   <appaction uniquename="crdff_NewCommand!a078463b5d7c473d8965f0f80469f412!crdff_CustomApp!crdff_entity1!1">
  <buttonlabeltext default="Show Alert">
    <label description="Show Alert" languagecode="1033" />
   </buttonlabeltext>
   <buttonsequencepriority>10.0000000000</buttonsequencepriority>
   <context>1</context>
   <contextentity>
    <logicalname>crdff_entity1</logicalname>
   </contextentity>
   <fonticon>AALinkedInLogo</fonticon>
   <contextvalue>crdff_entity1</contextvalue>
   <hidden>0</hidden>
   <iscustomizable>1</iscustomizable>
   <location>1</location>
   <name>EntityScoped!a078463b5d7c473d8965f0f80469f412</name>
   <onclickeventjavascriptfunctionname>ShowAppAlert</onclickeventjavascriptfunctionname>
   <onclickeventjavascriptparameters>[]</onclickeventjavascriptparameters>
   <onclickeventjavascriptwebresourceid>
    <webresourceid>ac21ad24-3c11-ef11-b6u7-000d3a1d942c</webresourceid>
   </onclickeventjavascriptwebresourceid>
   <onclickeventtype>2</onclickeventtype>
   <statecode>0</statecode>
   <statuscode>1</statuscode>
   <type>0</type>
   </appaction>

編輯並儲存 appaction 檔案之後,請以其匯出的格式來壓縮您的解決方案。 然後將解決方案匯入您的環境,並測試行為。

如何建立全域範圍命令

  1. 依照上述相同的步驟,編輯 appaction.xml 檔案。

  2. 從 xml 中刪除 appmoduleid 節點:

     <appmoduleid>
       <uniquename>demo_DemoFestApp</uniquename>
     </appmoduleid>
    
  3. 變更 appaction uniquename 的值。 變更最後一個字元中的任何一個就可以了 (例如從 1 到 2),或者如果需要的話,您也可以使用更具描述性的命名規則。

  4. 從 xml 中刪除 coNtextentitycoNtextvalue 節點:

    <contextentity>
     <logicalname>account</logicalname>
    </contextentity>
    <contextvalue>account</contextvalue>
    
  5. context 值從 1 變更為 0。

    <appaction uniquename="crdff_NewCommand1!8fe72a85-1f84-431e-ac56-854f1bfadc4e!1">
    <buttonlabeltext default="Show Alert">
    <label description="Show Alert" languagecode="1033" />
    </buttonlabeltext>
    <buttonsequencepriority>10.0000000000</buttonsequencepriority>
    <context>0</context>
    <hidden>0</hidden>
    <iscustomizable>1</iscustomizable>
    <fonticon>AALinkedInLogo</fonticon>
    <location>1</location>
    <name>EntityScoped!a078463b5d7c473d8965f0f80469f412</name>
    <onclickeventjavascriptfunctionname>ShowGlobalAlert</onclickeventjavascriptfunctionname>
    <onclickeventjavascriptparameters>[]</onclickeventjavascriptparameters>
    <onclickeventjavascriptwebresourceid>
     <webresourceid>ac21ad24-3c01-ec11-b6e7-000d3a1d942c</webresourceid>
    </onclickeventjavascriptwebresourceid>
    <onclickeventtype>2</onclickeventtype>
    <statecode>0</statecode>
    <statuscode>1</statuscode>
    <type>0</type>
    </appaction>
    

編輯並儲存 appaction 檔案之後,請以其匯出的格式來壓縮您的解決方案。 然後將解決方案匯入您的環境,並測試行為。

如何使用資料表範圍覆寫全域範圍命令

當您要讓全域範圍命令在除了特定資料表以外的所有位置都相同時,適用此範例。

  • 除了在 crdff_CustomApp 外,實體範圍動作將在所有應用程式的 crdff_entity1 格線中顯示。
  • 除了 crdff_entity1 外,全域範圍動作將在所有實體格線中顯示。

注意

若要使用應用程式範圍命令覆寫全域或資料表範圍命令,只需使用命令設計工具編輯命令。

若要使用資料表範圍命令覆寫全域範圍命令,請修改 appactions.xml 檔案,使它們具有相同的 XML <name>

覆寫步驟

  1. 請按照如何建立全域範圍命令中的步驟進行,但使用命令設計工具建立兩個命令。

  2. 如步驟所述,匯出您的解決方案並編輯 appactions.xml 檔案。

  3. 繼續按照步驟建立一個全域和一個實體範圍命令。

  4. 名稱屬性設定為與全域與實體範圍命令完全相同。

全域範圍命令 XML 範例

<appaction uniquename="crdff_NewCommand1!8fe72a85-1f84-431e-ac56-854f1bfadc4e!1">
<buttonlabeltext default="Show Alert">
 <label description="Show Alert" languagecode="1033" />
</buttonlabeltext>
<buttonsequencepriority>10.0000000000</buttonsequencepriority>
<context>0</context>
<hidden>0</hidden>
<iscustomizable>1</iscustomizable>
<fonticon>AALinkedInLogo</fonticon>
<location>1</location>
<name>EntityScoped!a078463b5d7c473d8965f0f80469f412</name>
<onclickeventjavascriptfunctionname>ShowGlobalAlert</onclickeventjavascriptfunctionname>
<onclickeventjavascriptparameters>[]</onclickeventjavascriptparameters>
<onclickeventjavascriptwebresourceid>
 <webresourceid>ac21ad24-3c01-ec11-b6e7-000d3a1d942c</webresourceid>
</onclickeventjavascriptwebresourceid>
<onclickeventtype>2</onclickeventtype>
<statecode>0</statecode>
<statuscode>1</statuscode>
<type>0</type>
</appaction>

資料表範圍命令 XML 範例

<appaction uniquename="crdff_NewCommand!a078463b5d7c473d8965f0f80469f412!crdff_entity1!1">
<buttonlabeltext default="Show Alert">
<label description="Show Alert" languagecode="1033" />
</buttonlabeltext>
<buttonsequencepriority>10.0000000000</buttonsequencepriority>
<context>1</context>
<contextentity>
<logicalname>crdff_entity1</logicalname>
</contextentity>
<fonticon>AALinkedInLogo</fonticon>
<contextvalue>crdff_entity1</contextvalue>
<hidden>0</hidden>
<iscustomizable>1</iscustomizable>
<location>1</location>
<name>EntityScoped!a078463b5d7c473d8965f0f80469f412</name>
<onclickeventjavascriptfunctionname>ShowEntityAlert</onclickeventjavascriptfunctionname>
<onclickeventjavascriptparameters>[]</onclickeventjavascriptparameters>
<onclickeventjavascriptwebresourceid>
<webresourceid>ac21ad24-3c01-ec11-b6e7-000d3a1d942c</webresourceid>
</onclickeventjavascriptwebresourceid>
<onclickeventtype>2</onclickeventtype>
<statecode>0</statecode>
<statuscode>1</statuscode>
<type>0</type>
</appaction>

注意

是否能請您告知您偏好的慣用文件語言? 請填寫問卷。 (請注意,本問卷為英文版)

完成問卷大約需要七分鐘。 本問卷將不會收集個人資料 (隱私權聲明)。