<?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 How to upload and store attachments from Service Portal widget to custom table in App Engine forum</title>
    <link>https://www.servicenow.com/community/app-engine-forum/how-to-upload-and-store-attachments-from-service-portal-widget/m-p/3465355#M9717</link>
    <description>&lt;P&gt;&lt;FONT color="#000000"&gt;Hi Community,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I am building an application and have a Service Portal requirement and need guidance.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I have created a custom table&amp;nbsp;and a Service Portal widget with a form that includes a file upload option. When the user submits the widget form from the portal, I want to:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Create record in table&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Upload and store the attached file against that same record (visible in the attachment section of the custom table record)&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Currently, the widget submits but the record and/or attachment is not getting saved in the custom table.&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jan 2026 10:49:42 GMT</pubDate>
    <dc:creator>Sneha KH</dc:creator>
    <dc:date>2026-01-12T10:49:42Z</dc:date>
    <item>
      <title>How to upload and store attachments from Service Portal widget to custom table</title>
      <link>https://www.servicenow.com/community/app-engine-forum/how-to-upload-and-store-attachments-from-service-portal-widget/m-p/3465355#M9717</link>
      <description>&lt;P&gt;&lt;FONT color="#000000"&gt;Hi Community,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I am building an application and have a Service Portal requirement and need guidance.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I have created a custom table&amp;nbsp;and a Service Portal widget with a form that includes a file upload option. When the user submits the widget form from the portal, I want to:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Create record in table&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Upload and store the attached file against that same record (visible in the attachment section of the custom table record)&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Currently, the widget submits but the record and/or attachment is not getting saved in the custom table.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jan 2026 10:49:42 GMT</pubDate>
      <guid>https://www.servicenow.com/community/app-engine-forum/how-to-upload-and-store-attachments-from-service-portal-widget/m-p/3465355#M9717</guid>
      <dc:creator>Sneha KH</dc:creator>
      <dc:date>2026-01-12T10:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload and store attachments from Service Portal widget to custom table</title>
      <link>https://www.servicenow.com/community/app-engine-forum/how-to-upload-and-store-attachments-from-service-portal-widget/m-p/3465377#M9718</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/877818"&gt;@Sneha KH&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;why not use after update BR on your table?&lt;/P&gt;
&lt;P&gt;Condition: Attachment field Changes [AND] Attachment Field [IS NOT EMPTY]&lt;/P&gt;
&lt;P&gt;Script:&lt;/P&gt;
&lt;P&gt;-&amp;gt; create record in other table&lt;/P&gt;
&lt;P&gt;-&amp;gt; use GlideSysAttachment API to copy the file to your record&lt;/P&gt;
&lt;P&gt;what did you start and where are you stuck?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jan 2026 11:12:28 GMT</pubDate>
      <guid>https://www.servicenow.com/community/app-engine-forum/how-to-upload-and-store-attachments-from-service-portal-widget/m-p/3465377#M9718</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2026-01-12T11:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload and store attachments from Service Portal widget to custom table</title>
      <link>https://www.servicenow.com/community/app-engine-forum/how-to-upload-and-store-attachments-from-service-portal-widget/m-p/3465386#M9719</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi&amp;nbsp;&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/877818"&gt;@Sneha KH&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This behavior is expected in Service Portal and usually happens because attachments are not handled automatically like platform forms.&lt;/P&gt;&lt;P&gt;In a Service Portal widget, you must explicitly control record creation and attachment upload. If either step is missed or done in the wrong order, the record or attachment will not be saved.&lt;/P&gt;&lt;P&gt;Below is the approach that works correctly.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Approach&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Attachments can only be saved after a record exists.&lt;BR /&gt;So the flow must be:&lt;/P&gt;&lt;P&gt;Create the record in the widget Server Script&lt;/P&gt;&lt;P&gt;Capture the generated sys_id&lt;/P&gt;&lt;P&gt;Return the sys_id to the Client Script&lt;/P&gt;&lt;P&gt;Upload the attachment using table name and sys_id&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Server Script&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(Create the custom table record first)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(function () {
if (input &amp;amp;&amp;amp; input.action === 'create') {
var gr = new GlideRecord('u_custom_table'); // custom table name
gr.initialize();
gr.u_short_description = input.short_description;
var sysId = gr.insert();

data.sys_id = sysId;
data.table = 'u_custom_table';
}
})();&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;Client Script&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(Upload attachment after record is created)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;api.controller = function ($scope, spAttachmentManager, spUtil) {

var c = this;
c.attachments = [];

c.submit = function () {

c.data.action = 'create';
c.data.short_description = c.short_description;

c.server.update().then(function (response) {

var sysId = response.data.sys_id;
var table = response.data.table;

if (sysId &amp;amp;&amp;amp; c.attachments.length &amp;gt; 0) {
spAttachmentManager.uploadAttachments(
table,
sysId,
c.attachments
).then(function () {
spUtil.addInfoMessage('Record and attachment saved successfully');
});
}
});
};
};&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;HTML&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(File upload field)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;input type="file" multiple ng-files="c.attachments" class="form-control"&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;*************************************************************************************************************&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;If this response helps, please mark it as Accept as Solution and Helpful.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Doing so helps others in the community and encourages me to keep contributing.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regards&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Vaishali Singh&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jan 2026 11:22:29 GMT</pubDate>
      <guid>https://www.servicenow.com/community/app-engine-forum/how-to-upload-and-store-attachments-from-service-portal-widget/m-p/3465386#M9719</guid>
      <dc:creator>vaishali231</dc:creator>
      <dc:date>2026-01-12T11:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload and store attachments from Service Portal widget to custom table</title>
      <link>https://www.servicenow.com/community/app-engine-forum/how-to-upload-and-store-attachments-from-service-portal-widget/m-p/3465416#M9720</link>
      <description>&lt;P&gt;We have tried this already but didn't work. Give me any other solutions if you have?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jan 2026 12:29:57 GMT</pubDate>
      <guid>https://www.servicenow.com/community/app-engine-forum/how-to-upload-and-store-attachments-from-service-portal-widget/m-p/3465416#M9720</guid>
      <dc:creator>Sneha KH</dc:creator>
      <dc:date>2026-01-12T12:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload and store attachments from Service Portal widget to custom table</title>
      <link>https://www.servicenow.com/community/app-engine-forum/how-to-upload-and-store-attachments-from-service-portal-widget/m-p/3465417#M9721</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I started creating public service portal by adding widget to it which helps in uploading a file. So, when I upload a file in portal, it is not storing in custom table. Only record is being created there is not data stored for attachments in it. (other values from portal are being stored in custom table, only attachment part is not stored). If you have any solutions, please do provide.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jan 2026 12:33:20 GMT</pubDate>
      <guid>https://www.servicenow.com/community/app-engine-forum/how-to-upload-and-store-attachments-from-service-portal-widget/m-p/3465417#M9721</guid>
      <dc:creator>Sneha KH</dc:creator>
      <dc:date>2026-01-12T12:33:20Z</dc:date>
    </item>
  </channel>
</rss>

