<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How to append dynamic grid data into rule input</title><link>https://community.appian.com/discussions/f/user-interface/39422/how-to-append-dynamic-grid-data-into-rule-input</link><description>Hi , I am working on requirement when creating a request for a user some plan will be available they can select any of the plan.Its ready only. It will be write to request plan table . Later in another task they will have option to select other plans</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to append dynamic grid data into rule input</title><link>https://community.appian.com/thread/149758?ContentTypeID=1</link><pubDate>Thu, 10 Jul 2025 05:53:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f901f1dc-1fc3-4bb0-b669-6f70a17931a8</guid><dc:creator>Shubham Aware</dc:creator><description>&lt;p&gt;I found&amp;nbsp;your save logic is incorrectly structured.&lt;br /&gt;Selected plans are being re-added to the grid instead of being saved to the rule input.&lt;br /&gt;No logic to update existing plans when plan names are edited.&lt;br /&gt;&lt;br /&gt;Try this below implementation&amp;nbsp;&lt;br /&gt;Note : As i can&amp;#39;t configure record in code properly so you have to check code properly.&lt;br /&gt;&lt;br /&gt;Save Button Code :-&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!buttonWidget(
  label: &amp;quot;Save&amp;quot;,
  saveInto: {
    a!save(
      target: ri!requestPlan,
      value: a!forEach(
        items: local!selectedPlans,
        expression: a!localVariables(
          local!currentPlan: index(local!gridDataforPlan, fv!item, {}),
          local!planId: index(
            local!currentPlan, 
            &amp;#39;recordType!Request Plans.fields.planId&amp;#39;, 
null()
),
local!existingIndex: wherecontains(
local!planId,
index(
ri!requestPlan, 
&amp;#39;recordType!Request Plans.fields.planId&amp;#39;, 
{}
)
),
if(
or(
isnull(local!existingIndex), 
length(local!existingIndex) = 0
),
/* Add new plan /
append(ri!requestPlan, local!currentPlan),
/ Update existing plan /
a!update(
data: ri!requestPlan,
index: local!existingIndex[1],
value: local!currentPlan
)
)
)
)
),
/ Clear selections after save */
a!save(local!selectedPlans, {})
},
style: &amp;quot;PRIMARY&amp;quot;
)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;Update your textField saveInto in the grid to properly save edits&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!textField(
  value: index(
    local!gridDataforPlan[fv!index],
    &amp;#39;recordType!Request Plans.fields.citPlan&amp;#39;,
    &amp;quot;&amp;quot;
  ),
  saveInto: a!save(
    local!gridDataforPlan[fv!index][&amp;#39;recordType!Request Plans.fields.citPlan&amp;#39;],
    save!value
  )
)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>