<?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>Create blank record type with all fields initialised</title><link>https://community.appian.com/discussions/f/general/39558/create-blank-record-type-with-all-fields-initialised</link><description>With CDTs I can do something like this to initialise a CDT with all fields set to blank/null 
 Is anyone aware of a similar approach with records? Casting {}, null(), or a!map() to a record type just returns null 
 In this use case I won&amp;#39;t know the field</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150708?ContentTypeID=1</link><pubDate>Tue, 05 Aug 2025 21:36:49 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3b7c5960-b35e-4d3e-a1d3-a50aee202ea3</guid><dc:creator>nathanp119</dc:creator><description>&lt;p&gt;Thanks. After the first few replies this is what I&amp;#39;d settled on too&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150707?ContentTypeID=1</link><pubDate>Tue, 05 Aug 2025 21:35:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:98fae40c-0a6b-4a6c-944d-222f1a4ba758</guid><dc:creator>nathanp119</dc:creator><description>&lt;p&gt;Marking this a the solution as it&amp;#39;s seems that there is no way.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150688?ContentTypeID=1</link><pubDate>Tue, 05 Aug 2025 13:22:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5ace1010-ebfe-43e2-bb92-ec7d166a1ff1</guid><dc:creator>Jesse Knight</dc:creator><description>&lt;p&gt;Given the rest of the conversation thus far, and based off of your context given, I think you&amp;#39;re best off storing the &lt;strong&gt;record fields&lt;/strong&gt;&amp;nbsp;in an expression. If you&amp;#39;re making a soft contract that the json schema will follow your data model field names, this should be fairly straightforward.&lt;/p&gt;
&lt;p&gt;The reasons that storing record fields in an expression rule won&amp;#39;t be as much of a headache:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The expression rule will show up as a dependent of the API, the record fields, and the overall record type&lt;/li&gt;
&lt;li&gt;You can call &lt;code&gt;tostring()&lt;/code&gt; on the field names to get the field name itself (not relationship names)&lt;/li&gt;
&lt;li&gt;As a bonus, this decouples your app&amp;#39;s data model from the JSON schema
&lt;ul&gt;
&lt;li&gt;Loose coupling allows you to return different subsets of fields for JSON schema validation based upon&amp;nbsp;complex business logic of the data itself (e.g. by a &amp;quot;type&amp;quot; or &amp;quot;status&amp;quot; field in the JSON) should you ever need to&lt;/li&gt;
&lt;li&gt;The clients of the API are agnostic to your refactoring efforts on the data model - calling &lt;code&gt;tostring(&amp;lt;record&amp;gt;.&amp;lt;relationship&amp;gt;.&amp;lt;field&amp;gt;)&lt;/code&gt; returns &lt;code&gt;&amp;lt;field&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It&amp;#39;s not a good idea to put unnecessary data fabric calls on a high-frequency API (e.g. for the sake of &lt;code&gt;a!keys()&lt;/code&gt; ). The data fabric can get overwhelmed fairly quickly if there are real-time record fields returned in the query or if the record type has even moderately complex row-level security. If this happens, the entire environment will slow down while the API&amp;#39;s process.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150687?ContentTypeID=1</link><pubDate>Tue, 05 Aug 2025 12:38:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7340758f-594d-4d60-885d-919c410887a1</guid><dc:creator>nathanp119</dc:creator><description>&lt;p&gt;Thanks for letting me know. Makes sense as to why I couldn&amp;#39;t find a reference to it&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150686?ContentTypeID=1</link><pubDate>Tue, 05 Aug 2025 12:34:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:76fde016-cac4-412e-bb93-bc35c8dd0095</guid><dc:creator>Mathieu Drouin</dc:creator><description>&lt;p&gt;Actually that selectionFields function does exist, its new in 25.3. (which hasn&amp;#39;t been released yet).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150667?ContentTypeID=1</link><pubDate>Tue, 05 Aug 2025 04:27:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cc2ba5d1-3523-467c-a6fe-6782d4c75f5e</guid><dc:creator>nathanp119</dc:creator><description>&lt;p&gt;Thanks for the option.I can&amp;#39;t guarantee that there will be one row so will need another option.&lt;br /&gt;And sorry for my assumption. I&amp;#39;ve just noticed that ChatGPT and the likes seems to include functions that don&amp;#39;t exist in their code when it&amp;#39;s generated.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150666?ContentTypeID=1</link><pubDate>Tue, 05 Aug 2025 03:49:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e7c1d496-502b-42c7-a2a3-f3d3c820443b</guid><dc:creator>Harsha Sharma</dc:creator><description>&lt;p&gt;Yes Atleast one row data is the pre requisite for this. And in the code (that I wrote myself) only the record types and related record reference (line 3,6&amp;amp;9) is modified to hide the record I used. That needs to be replaced with respective record type that you are using!&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150665?ContentTypeID=1</link><pubDate>Mon, 04 Aug 2025 22:29:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b8192e9c-07ea-4578-a4ea-7cdc3823422e</guid><dc:creator>nathanp119</dc:creator><description>&lt;p&gt;Thanks. From my understanding of that plugin (and please correct me if I&amp;#39;m wrong) I&amp;#39;d still need to store/manage the schema, which if I am going to do I might as well store manage the field names&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150664?ContentTypeID=1</link><pubDate>Mon, 04 Aug 2025 22:28:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2907414b-5948-4999-853b-795814232d4f</guid><dc:creator>nathanp119</dc:creator><description>&lt;p&gt;This solution will only work if there is data stored (and if I&amp;nbsp;fix what appears to be the AI generated code). For initial requests when the table is empty this would fail&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150649?ContentTypeID=1</link><pubDate>Mon, 04 Aug 2025 13:53:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5f32aaef-5db2-40ae-a4e9-3400aa93f532</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;If the requirement here is to meet the &amp;#39;contract first&amp;#39; paradigm (where you validate incoming payloads as a prerequisite to dispatching for processing if valid or responding with HTTP 400 - bad data - if invalid), then I&amp;#39;d encourage you to use JSON Schema validation as this provides a declarative method for validating payloads. Cast or map your incoming message to JSON and then use the &lt;a href="/b/appmarket/posts/load-json-file-to-database"&gt;schema validation available in this plug-in&lt;/a&gt; to conduct your validations.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150646?ContentTypeID=1</link><pubDate>Mon, 04 Aug 2025 13:33:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f2179c07-cb90-4962-8a64-ca3dbd864a06</guid><dc:creator>Harsha Sharma</dc:creator><description>&lt;p&gt;If I understood the requirements correctly, the function a!keys() can help you dynamically get the fields from record. Using the output you can match the keys with payload keys. Here is a sample expression for reference.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!recordData: a!queryRecordType(
    recordType: recordType!recordName,
    pagingInfo: a!pagingInfo(1, 1),
    fields: a!selectionFields(
      allFieldsFromRecordType: recordType!recordName,
      includeRealTimeCustomFields: true(),
      includeExtraLongTextFields: true(),
      selectFields: recordtype!relatedRecordFields
    )
  ).data,
  a!keys(local!recordData[1])
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150623?ContentTypeID=1</link><pubDate>Mon, 04 Aug 2025 07:56:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ecc0d9c0-d431-4ebf-91c4-40a435764460</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;OK. Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150620?ContentTypeID=1</link><pubDate>Mon, 04 Aug 2025 07:05:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:259f8a7b-fc67-4538-8418-2909cf85956a</guid><dc:creator>nathanp119</dc:creator><description>&lt;p&gt;Validation of payload from external systems before writing the data, eg if payload from external system doesn&amp;#39;t match the record type / CDT being written then return a 400.&lt;br /&gt;&lt;br /&gt;With older apps that use CDTs, we can store the type #, then get the&amp;nbsp;keys from a blank initialised CDT (using the cast method above) and compare it to the keys in the JSON payload. &lt;br /&gt;&lt;br /&gt;With records, it seems we&amp;#39;d need store all the record field names to be able to compare them, which makes it more difficult to manage in the long run if fields change with code changes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150617?ContentTypeID=1</link><pubDate>Mon, 04 Aug 2025 06:33:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dde2152f-b5bd-4ee5-8cd5-25536e5e4718</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Why is that important? What do you want to achieve?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150616?ContentTypeID=1</link><pubDate>Mon, 04 Aug 2025 05:38:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fdea784b-5abf-4b42-b9b3-3c6cfa1fb5a9</guid><dc:creator>Harsha Sharma</dc:creator><description>&lt;p&gt;You are correct! To work with local variables of record type we need to reference record fields using reference everywhere needed.&amp;nbsp;&lt;/p&gt;
[quote userid="13625" url="~/discussions/f/general/39558/create-blank-record-type-with-all-fields-initialised"]In this use case I won&amp;#39;t know the field names to be able to use them. I only have the record type[/quote]
&lt;p&gt;Typing in recordtype!recordName.fields.... is the only way to know the field names and use with local variables indexing.&lt;/p&gt;
&lt;p&gt;I personally try to work as much as possible with rule inputs instead of local variables Or, call a&amp;nbsp;reusable constructor rule instead of ad-hoc expressions wherever needed!&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150615?ContentTypeID=1</link><pubDate>Mon, 04 Aug 2025 05:07:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3a18cd4e-e581-4c35-a804-a22d21fb0892</guid><dc:creator>Shubham Aware</dc:creator><description>&lt;p&gt;Got you!&lt;br /&gt;There&amp;#39;s no direct equivalent for Record Types. Unlike CDTs, you cannot initialize a record type with all fields set to null without knowing field names.&lt;br /&gt;&lt;br /&gt;If you want to set fields explicitly, you must do it field-by-field like this:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;recordType!Employee(
  name: &amp;quot;&amp;quot;,
  age: null,
  email: &amp;quot;&amp;quot;
)
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150614?ContentTypeID=1</link><pubDate>Mon, 04 Aug 2025 05:03:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bb71ad05-f8d0-4f3c-996b-2313632a8dd3</guid><dc:creator>nathanp119</dc:creator><description>&lt;p&gt;This doesn&amp;#39;t work. It simply returns a blank record type. None of the fields are initialsed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Create blank record type with all fields initialised</title><link>https://community.appian.com/thread/150613?ContentTypeID=1</link><pubDate>Mon, 04 Aug 2025 05:01:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3d140842-a5db-4173-8090-c74d1f527caa</guid><dc:creator>Shubham Aware</dc:creator><description>&lt;p&gt;Use the record type constructor with empty parentheses:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;recordType!YourRecordType()&lt;/pre&gt;&lt;br /&gt;This creates a record instance with all fields set to null/default values, similar to cast() with CDTs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>