<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Adding association as input parameter for custom acti... in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/adding-association-as-input-parameter-for-custom-action-in-cap/qaa-p/13884359#M4886288</link>
    <description>&lt;P&gt;I think essentially it's doing the same thing that my approach does. You have assigned the action a valuehelp and storing the data in a string field&lt;/P&gt;&lt;PRE&gt;AuthorisationType : String(30)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;And then in the JS file you are creating a draft for that entity with the inputed data. But if you assign the action's input type a field that is an association field i.e.&lt;/P&gt;&lt;P&gt;someAction(inp : someEntity : associationFeildOfThatEntity)&lt;/P&gt;&lt;P&gt;Or any variation of this&amp;nbsp;it will give you an error. The issue is that if the associated entity i.e. the entity in the Collection path of the value help has a composite key then that means that every single column has values that are repeating, And if the user tries to select multiple values , it will only let you select those that have different values in the field&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ValueListProperty&lt;/PRE&gt;&lt;P&gt;Thus ignoring some of the values .&lt;/P&gt;</description>
    <pubDate>Tue, 01 Oct 2024 10:36:22 GMT</pubDate>
    <dc:creator>David21</dc:creator>
    <dc:date>2024-10-01T10:36:22Z</dc:date>
    <item>
      <title>Adding association as input parameter for custom action in CAP</title>
      <link>https://community.sap.com/t5/technology-q-a/adding-association-as-input-parameter-for-custom-action-in-cap/qaq-p/13883503</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I'm using CAP(Node.js) with odata(v4) &amp;amp; fiori elements. I am creating a custom add button so that user can add multiple values from valuehelp to draft rather than using the create button which allows you to create only one entry at a time.&amp;nbsp; As we know that you can't use associations as an input parameter of custom actions, So I have been using a workaround for it. Create a type in cds service file with a field that has type array of string i.e type customType{someField : array of String}, Use this field as an input parameter i.e.&amp;nbsp;&lt;SPAN&gt;action&lt;/SPAN&gt; &lt;SPAN&gt;someAction&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;someField&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;customType&lt;/SPAN&gt; &lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; someField), And then assigning a valueHelp to this field through annotations.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This works fine if the associated entity has only one key. But if the associated entity has two key fields&amp;nbsp; i.e. composite key, there doesn't seem to be a way to store both the keys from the valueHelp. Any ideas on how to achive this ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I used the following blog to implement this work around (&lt;STRONG&gt;6. Action with Value Help Input&lt;/STRONG&gt;) :&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://community.sap.com/t5/technology-blogs-by-sap/cap-with-fiori-elements-actions-on-list-report-object-page-using/ba-p/13572833" target="_blank"&gt;https://community.sap.com/t5/technology-blogs-by-sap/cap-with-fiori-elements-actions-on-list-report-object-page-using/ba-p/13572833&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 20:37:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/adding-association-as-input-parameter-for-custom-action-in-cap/qaq-p/13883503</guid>
      <dc:creator>David21</dc:creator>
      <dc:date>2024-09-30T20:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Adding association as input parameter for custom action in CAP</title>
      <link>https://community.sap.com/t5/technology-q-a/adding-association-as-input-parameter-for-custom-action-in-cap/qaa-p/13883682#M4886232</link>
      <description>&lt;P&gt;Are you sure this is correct?&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;As we know that you can't use associations as an input parameter of custom actions,&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Taking a look at one of my projects,&amp;nbsp;&lt;A href="https://github.com/MertSAP/AppTemplater/blob/main/srv/apptemplater-service.cds," target="_blank"&gt;https://github.com/MertSAP/AppTemplater/blob/main/srv/apptemplater-service.cds,&lt;/A&gt;&amp;nbsp;I have done something like this in the past:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; entity ServiceRole             as projection on my.ServiceRole actions {
        action fillEntities(@(
                             title:'Auth Type',
                             Common:{
                                 ValueListWithFixedValues: true,
                                 ValueList               : {
                                     Label         : '{i18n&amp;gt;ServiceAuth}',
                                     CollectionPath: 'AuthorisationType',
                                     Parameters    : [{
                                         $Type            : 'Common.ValueListParameterInOut',
                                         ValueListProperty: 'AuthorisationType',
                                         LocalDataProperty: AuthorisationType
                                     }]
                                 }
                             }
                         )
                         AuthorisationType : String(30));
    };

    entity ServiceAuth        as projection on my.ServiceAuth;
    entity AssociationType   as projection on my.AssociationType;&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 01 Oct 2024 01:55:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/adding-association-as-input-parameter-for-custom-action-in-cap/qaa-p/13883682#M4886232</guid>
      <dc:creator>MattBrightman</dc:creator>
      <dc:date>2024-10-01T01:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: Adding association as input parameter for custom acti...</title>
      <link>https://community.sap.com/t5/technology-q-a/adding-association-as-input-parameter-for-custom-action-in-cap/qaa-p/13884359#M4886288</link>
      <description>&lt;P&gt;I think essentially it's doing the same thing that my approach does. You have assigned the action a valuehelp and storing the data in a string field&lt;/P&gt;&lt;PRE&gt;AuthorisationType : String(30)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;And then in the JS file you are creating a draft for that entity with the inputed data. But if you assign the action's input type a field that is an association field i.e.&lt;/P&gt;&lt;P&gt;someAction(inp : someEntity : associationFeildOfThatEntity)&lt;/P&gt;&lt;P&gt;Or any variation of this&amp;nbsp;it will give you an error. The issue is that if the associated entity i.e. the entity in the Collection path of the value help has a composite key then that means that every single column has values that are repeating, And if the user tries to select multiple values , it will only let you select those that have different values in the field&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ValueListProperty&lt;/PRE&gt;&lt;P&gt;Thus ignoring some of the values .&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 10:36:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/adding-association-as-input-parameter-for-custom-action-in-cap/qaa-p/13884359#M4886288</guid>
      <dc:creator>David21</dc:creator>
      <dc:date>2024-10-01T10:36:22Z</dc:date>
    </item>
  </channel>
</rss>

