<?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 NiFi ExecuteScript - Able to add attributes to created FlowFiles? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/NiFi-ExecuteScript-Able-to-add-attributes-to-created/m-p/331650#M230933</link>
    <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Hi all, I am passing a FlowFile&amp;nbsp;with several custom attributes to my ExecuteScript processor (running python). I want the ExecuteScript to create two new FlowFiles, each having their own set of attributes (the values are to be retrieved from the input FlowFile). Problem is, I am unable to add any attributes to the two new flowfiles and it throws the error &lt;EM&gt;"org.apache.nifi.controller.repository.StandardFlow" object has no attribute "putAttribute"&lt;/EM&gt;.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;flowFile = session.get()
if flowFile != None:
    ...
    destFlowFile = session.create(flowFile)
    # doesn't work
    destFlowFile.putAttribute(destFlowFile, "logMsg", "Testing Msg")
    destFlowFile.putAllAttributes(destFlowFile, backupAttributes)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&amp;nbsp;I've followed the examples listed in this guide &lt;A href="https://community.cloudera.com/t5/Community-Articles/ExecuteScript-Cookbook-part-1/ta-p/248922" target="_blank" rel="noopener"&gt;https://community.cloudera.com/t5/Community-Articles/ExecuteScript-Cookbook-part-1/ta-p/248922&lt;/A&gt;, hence I wasn't expecting this to not work. Is it just not possible to add attributes to created FlowFiles and if so, are there any alternative methods? Thank you!&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Dec 2021 10:02:27 GMT</pubDate>
    <dc:creator>Daruul</dc:creator>
    <dc:date>2021-12-06T10:02:27Z</dc:date>
    <item>
      <title>NiFi ExecuteScript - Able to add attributes to created FlowFiles?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-ExecuteScript-Able-to-add-attributes-to-created/m-p/331650#M230933</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Hi all, I am passing a FlowFile&amp;nbsp;with several custom attributes to my ExecuteScript processor (running python). I want the ExecuteScript to create two new FlowFiles, each having their own set of attributes (the values are to be retrieved from the input FlowFile). Problem is, I am unable to add any attributes to the two new flowfiles and it throws the error &lt;EM&gt;"org.apache.nifi.controller.repository.StandardFlow" object has no attribute "putAttribute"&lt;/EM&gt;.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;flowFile = session.get()
if flowFile != None:
    ...
    destFlowFile = session.create(flowFile)
    # doesn't work
    destFlowFile.putAttribute(destFlowFile, "logMsg", "Testing Msg")
    destFlowFile.putAllAttributes(destFlowFile, backupAttributes)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&amp;nbsp;I've followed the examples listed in this guide &lt;A href="https://community.cloudera.com/t5/Community-Articles/ExecuteScript-Cookbook-part-1/ta-p/248922" target="_blank" rel="noopener"&gt;https://community.cloudera.com/t5/Community-Articles/ExecuteScript-Cookbook-part-1/ta-p/248922&lt;/A&gt;, hence I wasn't expecting this to not work. Is it just not possible to add attributes to created FlowFiles and if so, are there any alternative methods? Thank you!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 10:02:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-ExecuteScript-Able-to-add-attributes-to-created/m-p/331650#M230933</guid>
      <dc:creator>Daruul</dc:creator>
      <dc:date>2021-12-06T10:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi ExecuteScript - Able to add attributes to created FlowFiles?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-ExecuteScript-Able-to-add-attributes-to-created/m-p/331727#M230953</link>
      <description>&lt;P&gt;The operation to add an attribute to a FlowFile is on the ProcessSession object not the FlowFile itself (so the session can keep track of changes).&amp;nbsp; Try the following instead:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;session.putAttribute(destFlowFile,&amp;nbsp;, "logMsg", "Testing Msg")&lt;/P&gt;&lt;P&gt;session.putAllAttributes(destFlowFile, backupAttributes)&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 17:19:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-ExecuteScript-Able-to-add-attributes-to-created/m-p/331727#M230953</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2021-12-07T17:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi ExecuteScript - Able to add attributes to created FlowFiles?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-ExecuteScript-Able-to-add-attributes-to-created/m-p/331729#M230955</link>
      <description>&lt;P&gt;Ah I'm so careless, thanks for pointing that out!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 17:34:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-ExecuteScript-Able-to-add-attributes-to-created/m-p/331729#M230955</guid>
      <dc:creator>Daruul</dc:creator>
      <dc:date>2021-12-07T17:34:15Z</dc:date>
    </item>
  </channel>
</rss>

