<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communitytest.tessitura.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>TNEW Custom Form Stored Procedures</title><link>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures</link><description>Wiki for creating community documentation.</description><dc:language>en-US</dc:language><generator>Telligent Community 12 Non-Production</generator><item><title>TNEW Custom Form Stored Procedures</title><link>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures</link><pubDate>Tue, 25 May 2021 06:02:30 GMT</pubDate><guid isPermaLink="false">fd08b0f2-65fa-4b2b-916a-cce3e88b61d0:96d78ec9-e8cf-4c9c-90c7-7ab5084c6a6b</guid><dc:creator>Nick Reilingh</dc:creator><comments>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures#comments</comments><description>Current Revision posted to Community Docs Wiki by Nick Reilingh on 5/25/2021 6:02:30 AM&lt;br /&gt;
&lt;p&gt;The API is described here at the VERY BOTTOM of the page:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm"&gt;https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note that @line_id is&amp;nbsp;required on product-based custom forms, but not on a checkout survey form. @line_id means something different based on the product type that the form is being submitted on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Contribution: @line_id is the&amp;nbsp;ref_no, and can be looked up in dbo.T_WEB_CONTRIBUTION for the duration of the session.&lt;/li&gt;
&lt;li&gt;Performance (Ticket): @line_id is the li_seq_no, and can be looked up in dbo.T_WEB_LINEITEM. This used to be passed as @li_seq_no.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;TIPS:&lt;/h3&gt;
&lt;p&gt;When debugging these procedures, note that TNEW maintains backward compatibility with the old @li_seq_no parameter by executing the procedure using @line_id first, and then if that execution fails, it submits an additional execution using @li_seq_no as the parameter name instead. It does not filter on execution failures due to missing parameters. This means that you could have written your procedure&amp;#39;s parameter signature correctly but still have an unrelated error in your code, and the last message you see in the TNEW logs will be an error related to parameters, since this failure will be from TNEW retrying with the old parameter name. Make sure to scroll past the most recent error to the initial execution to see what the actual issue was with your procedure. Also, don&amp;#39;t add both @li_seq_no and @line_id to your procedure&amp;#39;s parameter signature as optional, because then if your procedure encounters an&amp;nbsp;actual error state, it could get executed &lt;em&gt;again&lt;/em&gt;, and that may cause&amp;nbsp;duplicate data&amp;nbsp;since these procedures are not intended to be idempotent. (N.B. TNEW should just get rid of this backward compatibility to make this all simpler; hopefully this occurs in V16.)&lt;/p&gt;
&lt;p&gt;TO CONFIRM: If all of the fields in a form are optional, the stored procedure will NOT fire if the form is interacted with, but WILL fire if the form is interacted with, even if the state of the form is the same as when the page loaded.&lt;/p&gt;
&lt;p&gt;TO CONFIRM: All stored procedures are invoked when the order is being saved; after payment has been accepted, but before the order is fully completed.&lt;/p&gt;
&lt;p&gt;To suppress procedure functionality when the form is submitted empty, you must add conditional logic to your procedure.&lt;/p&gt;
&lt;p&gt;When switching from default CSI creation to stored procedure execution, a couple of data points that are supplied automatically on CSIs are not provided directly to the procedure, depending on the product type.&lt;/p&gt;
&lt;p&gt;For example, a custom form on a contribution saved to a CSI will include Contrib Type, Contrib Amount, Ref No (as Line Item ID), and Order Number by default in addition to the form fields, but when saving to a stored procedure, only @line_id is supplied along with the sessionkey and form fields.&amp;nbsp;If you need these other data points, you must fetch them yourself.&lt;/p&gt;
&lt;p&gt;Fetch Contrib Type Example:&lt;/p&gt;
&lt;pre class="p1"&gt;&lt;span class="s1"&gt;DECLARE&lt;/span&gt; @contrib_type &lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="s1"&gt;WITH&lt;/span&gt; semicolon_split &lt;span class="s1"&gt;AS &lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;SELECT&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ct_start &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;CHARINDEX&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s5"&gt;&amp;#39;c&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;+&lt;/span&gt; 1&lt;span class="s2"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ct_end &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;CHARINDEX&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s5"&gt;&amp;#39;_&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; dbo&lt;span class="s2"&gt;.&lt;/span&gt;T_WEB_ORDER&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s2"&gt;CROSS&lt;/span&gt; &lt;span class="s2"&gt;APPLY&lt;/span&gt; &lt;span class="s4"&gt;STRING_SPLIT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;notes&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s5"&gt;&amp;#39;;&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;WHERE&lt;/span&gt; sessionkey &lt;span class="s2"&gt;=&lt;/span&gt; @sessionKey&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="s2"&gt;AND&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s2"&gt;LIKE&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&amp;#39;%c%[0-9]\_[0-9]%&amp;#39;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s1"&gt;ESCAPE&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&amp;#39;\&amp;#39;&lt;br /&gt;&lt;span class="s2"&gt;),&lt;/span&gt; parsed &lt;span class="s1"&gt;AS &lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;SELECT&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;contrib_type &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;TRY_CONVERT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;SUBSTRING&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_start&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end &lt;span class="s2"&gt;-&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_start&lt;span class="s2"&gt;)),&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ref_no &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;TRY_CONVERT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;SUBSTRING&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end &lt;span class="s2"&gt;+&lt;/span&gt; 1&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;LEN&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;-&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end&lt;span class="s2"&gt;))&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; semicolon_split s&lt;br /&gt;)&lt;br /&gt;&lt;span class="s1"&gt;SELECT&lt;/span&gt; @contrib_type &lt;span class="s2"&gt;=&lt;/span&gt; contrib_type&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; parsed&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;WHERE&lt;/span&gt; ref_no &lt;span class="s2"&gt;=&lt;/span&gt; @line_id&lt;span class="s2"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: tnew, custom form&lt;/div&gt;
</description></item><item><title>TNEW Custom Form Stored Procedures</title><link>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures/revision/9</link><pubDate>Sat, 23 Jan 2021 10:21:10 GMT</pubDate><guid isPermaLink="false">fd08b0f2-65fa-4b2b-916a-cce3e88b61d0:96d78ec9-e8cf-4c9c-90c7-7ab5084c6a6b</guid><dc:creator>Nick Reilingh</dc:creator><comments>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures#comments</comments><description>Revision 9 posted to Community Docs Wiki by Nick Reilingh on 1/23/2021 10:21:10 AM&lt;br /&gt;
&lt;p&gt;The API is described here at the VERY BOTTOM of the page:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm"&gt;https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note that @line_id is&amp;nbsp;required on product-based custom forms, but not on a checkout survey form. @line_id means something different based on the product type that the form is being submitted on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Contribution: @line_id is the&amp;nbsp;ref_no, and can be looked up in dbo.T_WEB_CONTRIBUTION for the duration of the session.&lt;/li&gt;
&lt;li&gt;Performance (Ticket): @line_id is the li_seq_no, and can be looked up in dbo.T_WEB_LINEITEM&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;TIPS:&lt;/h3&gt;
&lt;p&gt;TO CONFIRM: If all of the fields in a form are optional, the stored procedure will NOT fire if the form is interacted with, but WILL fire if the form is interacted with, even if the state of the form is the same as when the page loaded.&lt;/p&gt;
&lt;p&gt;TO CONFIRM: All stored procedures are invoked when the order is being saved; after payment has been accepted, but before the order is fully completed.&lt;/p&gt;
&lt;p&gt;To suppress procedure functionality when the form is submitted empty, you must add conditional logic to your procedure.&lt;/p&gt;
&lt;p&gt;When switching from default CSI creation to stored procedure execution, a couple of data points that are supplied automatically on CSIs are not provided directly to the procedure, depending on the product type.&lt;/p&gt;
&lt;p&gt;For example, a custom form on a contribution saved to a CSI will include Contrib Type, Contrib Amount, Ref No (as Line Item ID), and Order Number by default in addition to the form fields, but when saving to a stored procedure, only @line_id is supplied along with the sessionkey and form fields.&amp;nbsp;If you need these other data points, you must fetch them yourself.&lt;/p&gt;
&lt;p&gt;Fetch Contrib Type Example:&lt;/p&gt;
&lt;pre class="p1"&gt;&lt;span class="s1"&gt;DECLARE&lt;/span&gt; @contrib_type &lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="s1"&gt;WITH&lt;/span&gt; semicolon_split &lt;span class="s1"&gt;AS &lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;SELECT&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ct_start &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;CHARINDEX&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s5"&gt;&amp;#39;c&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;+&lt;/span&gt; 1&lt;span class="s2"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ct_end &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;CHARINDEX&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s5"&gt;&amp;#39;_&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; dbo&lt;span class="s2"&gt;.&lt;/span&gt;T_WEB_ORDER&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s2"&gt;CROSS&lt;/span&gt; &lt;span class="s2"&gt;APPLY&lt;/span&gt; &lt;span class="s4"&gt;STRING_SPLIT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;notes&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s5"&gt;&amp;#39;;&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;WHERE&lt;/span&gt; sessionkey &lt;span class="s2"&gt;=&lt;/span&gt; @sessionKey&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="s2"&gt;AND&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s2"&gt;LIKE&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&amp;#39;%c%[0-9]\_[0-9]%&amp;#39;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s1"&gt;ESCAPE&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&amp;#39;\&amp;#39;&lt;br /&gt;&lt;span class="s2"&gt;),&lt;/span&gt; parsed &lt;span class="s1"&gt;AS &lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;SELECT&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;contrib_type &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;TRY_CONVERT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;SUBSTRING&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_start&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end &lt;span class="s2"&gt;-&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_start&lt;span class="s2"&gt;)),&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ref_no &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;TRY_CONVERT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;SUBSTRING&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end &lt;span class="s2"&gt;+&lt;/span&gt; 1&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;LEN&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;-&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end&lt;span class="s2"&gt;))&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; semicolon_split s&lt;br /&gt;)&lt;br /&gt;&lt;span class="s1"&gt;SELECT&lt;/span&gt; @contrib_type &lt;span class="s2"&gt;=&lt;/span&gt; contrib_type&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; parsed&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;WHERE&lt;/span&gt; ref_no &lt;span class="s2"&gt;=&lt;/span&gt; @line_id&lt;span class="s2"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: tnew, custom form&lt;/div&gt;
</description></item><item><title>TNEW Custom Form Stored Procedures</title><link>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures/revision/8</link><pubDate>Sat, 23 Jan 2021 10:20:14 GMT</pubDate><guid isPermaLink="false">fd08b0f2-65fa-4b2b-916a-cce3e88b61d0:96d78ec9-e8cf-4c9c-90c7-7ab5084c6a6b</guid><dc:creator>Nick Reilingh</dc:creator><comments>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures#comments</comments><description>Revision 8 posted to Community Docs Wiki by Nick Reilingh on 1/23/2021 10:20:14 AM&lt;br /&gt;
&lt;p&gt;The API is described here at the VERY BOTTOM of the page:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm"&gt;https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note that @line_id is&amp;nbsp;required on product-based custom forms, but not on a checkout survey form. @line_id means something different based on the product type that the form is being submitted on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Contribution: @line_id is the&amp;nbsp;ref_no, and can be looked up in dbo.T_WEB_CONTRIBUTION for the duration of the session.&lt;/li&gt;
&lt;li&gt;Performance (Ticket): @line_id is the li_seq_no, and can be looked up in dbo.T_WEB_LINEITEM&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;TIPS:&lt;/h3&gt;
&lt;h1&gt;Header 1&lt;/h1&gt;
&lt;h2&gt;Header 2&lt;/h2&gt;
&lt;h3&gt;Header 3&lt;/h3&gt;
&lt;h4&gt;Header 4&lt;/h4&gt;
&lt;h5&gt;Header 5&lt;/h5&gt;
&lt;h6&gt;Header 6&lt;/h6&gt;
&lt;p&gt;TO CONFIRM: If all of the fields in a form are optional, the stored procedure will NOT fire if the form is interacted with, but WILL fire if the form is interacted with, even if the state of the form is the same as when the page loaded.&lt;/p&gt;
&lt;p&gt;TO CONFIRM: All stored procedures are invoked when the order is being saved; after payment has been accepted, but before the order is fully completed.&lt;/p&gt;
&lt;p&gt;To suppress procedure functionality when the form is submitted empty, you must add conditional logic to your procedure.&lt;/p&gt;
&lt;p&gt;When switching from default CSI creation to stored procedure execution, a couple of data points that are supplied automatically on CSIs are not provided directly to the procedure, depending on the product type.&lt;/p&gt;
&lt;p&gt;For example, a custom form on a contribution saved to a CSI will include Contrib Type, Contrib Amount, Ref No (as Line Item ID), and Order Number by default in addition to the form fields, but when saving to a stored procedure, only @line_id is supplied along with the sessionkey and form fields.&amp;nbsp;If you need these other data points, you must fetch them yourself.&lt;/p&gt;
&lt;p&gt;Fetch Contrib Type Example:&lt;/p&gt;
&lt;pre class="p1"&gt;&lt;span class="s1"&gt;DECLARE&lt;/span&gt; @contrib_type &lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="s1"&gt;WITH&lt;/span&gt; semicolon_split &lt;span class="s1"&gt;AS &lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;SELECT&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ct_start &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;CHARINDEX&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s5"&gt;&amp;#39;c&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;+&lt;/span&gt; 1&lt;span class="s2"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ct_end &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;CHARINDEX&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s5"&gt;&amp;#39;_&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; dbo&lt;span class="s2"&gt;.&lt;/span&gt;T_WEB_ORDER&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s2"&gt;CROSS&lt;/span&gt; &lt;span class="s2"&gt;APPLY&lt;/span&gt; &lt;span class="s4"&gt;STRING_SPLIT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;notes&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s5"&gt;&amp;#39;;&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;WHERE&lt;/span&gt; sessionkey &lt;span class="s2"&gt;=&lt;/span&gt; @sessionKey&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="s2"&gt;AND&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s2"&gt;LIKE&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&amp;#39;%c%[0-9]\_[0-9]%&amp;#39;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s1"&gt;ESCAPE&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&amp;#39;\&amp;#39;&lt;br /&gt;&lt;span class="s2"&gt;),&lt;/span&gt; parsed &lt;span class="s1"&gt;AS &lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;SELECT&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;contrib_type &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;TRY_CONVERT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;SUBSTRING&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_start&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end &lt;span class="s2"&gt;-&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_start&lt;span class="s2"&gt;)),&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ref_no &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;TRY_CONVERT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;SUBSTRING&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end &lt;span class="s2"&gt;+&lt;/span&gt; 1&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;LEN&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;-&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end&lt;span class="s2"&gt;))&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; semicolon_split s&lt;br /&gt;)&lt;br /&gt;&lt;span class="s1"&gt;SELECT&lt;/span&gt; @contrib_type &lt;span class="s2"&gt;=&lt;/span&gt; contrib_type&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; parsed&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;WHERE&lt;/span&gt; ref_no &lt;span class="s2"&gt;=&lt;/span&gt; @line_id&lt;span class="s2"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: tnew, custom form&lt;/div&gt;
</description></item><item><title>TNEW Custom Form Stored Procedures</title><link>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures/revision/7</link><pubDate>Sat, 23 Jan 2021 09:41:26 GMT</pubDate><guid isPermaLink="false">fd08b0f2-65fa-4b2b-916a-cce3e88b61d0:96d78ec9-e8cf-4c9c-90c7-7ab5084c6a6b</guid><dc:creator>Nick Reilingh</dc:creator><comments>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures#comments</comments><description>Revision 7 posted to Community Docs Wiki by Nick Reilingh on 1/23/2021 9:41:26 AM&lt;br /&gt;
&lt;p&gt;The API is described here at the VERY BOTTOM of the page:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm"&gt;https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note that @line_id is&amp;nbsp;required on product-based custom forms, but not on a checkout survey form. @line_id means something different based on the product type that the form is being submitted on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Contribution: @line_id is the&amp;nbsp;ref_no, and can be looked up in dbo.T_WEB_CONTRIBUTION for the duration of the session.&lt;/li&gt;
&lt;li&gt;Performance (Ticket): @line_id is the li_seq_no, and can be looked up in dbo.T_WEB_LINEITEM&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;TIPS:&lt;/h3&gt;
&lt;p&gt;TO CONFIRM: If all of the fields in a form are optional, the stored procedure will NOT fire if the form is interacted with, but WILL fire if the form is interacted with, even if the state of the form is the same as when the page loaded.&lt;/p&gt;
&lt;p&gt;TO CONFIRM: All stored procedures are invoked when the order is being saved; after payment has been accepted, but before the order is fully completed.&lt;/p&gt;
&lt;p&gt;To suppress procedure functionality when the form is submitted empty, you must add conditional logic to your procedure.&lt;/p&gt;
&lt;p&gt;When switching from default CSI creation to stored procedure execution, a couple of data points that are supplied automatically on CSIs are not provided directly to the procedure, depending on the product type.&lt;/p&gt;
&lt;p&gt;For example, a custom form on a contribution saved to a CSI will include Contrib Type, Contrib Amount, Ref No (as Line Item ID), and Order Number by default in addition to the form fields, but when saving to a stored procedure, only @line_id is supplied along with the sessionkey and form fields.&amp;nbsp;If you need these other data points, you must fetch them yourself.&lt;/p&gt;
&lt;p&gt;Fetch Contrib Type Example:&lt;/p&gt;
&lt;pre class="p1"&gt;&lt;span class="s1"&gt;DECLARE&lt;/span&gt; @contrib_type &lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="s1"&gt;WITH&lt;/span&gt; semicolon_split &lt;span class="s1"&gt;AS &lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;SELECT&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ct_start &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;CHARINDEX&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s5"&gt;&amp;#39;c&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;+&lt;/span&gt; 1&lt;span class="s2"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ct_end &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;CHARINDEX&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s5"&gt;&amp;#39;_&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; dbo&lt;span class="s2"&gt;.&lt;/span&gt;T_WEB_ORDER&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s2"&gt;CROSS&lt;/span&gt; &lt;span class="s2"&gt;APPLY&lt;/span&gt; &lt;span class="s4"&gt;STRING_SPLIT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;notes&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s5"&gt;&amp;#39;;&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;WHERE&lt;/span&gt; sessionkey &lt;span class="s2"&gt;=&lt;/span&gt; @sessionKey&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="s2"&gt;AND&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s2"&gt;LIKE&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&amp;#39;%c%[0-9]\_[0-9]%&amp;#39;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s1"&gt;ESCAPE&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&amp;#39;\&amp;#39;&lt;br /&gt;&lt;span class="s2"&gt;),&lt;/span&gt; parsed &lt;span class="s1"&gt;AS &lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;SELECT&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;contrib_type &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;TRY_CONVERT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;SUBSTRING&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_start&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end &lt;span class="s2"&gt;-&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_start&lt;span class="s2"&gt;)),&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ref_no &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;TRY_CONVERT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;SUBSTRING&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end &lt;span class="s2"&gt;+&lt;/span&gt; 1&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;LEN&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;-&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end&lt;span class="s2"&gt;))&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; semicolon_split s&lt;br /&gt;)&lt;br /&gt;&lt;span class="s1"&gt;SELECT&lt;/span&gt; @contrib_type &lt;span class="s2"&gt;=&lt;/span&gt; contrib_type&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; parsed&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;WHERE&lt;/span&gt; ref_no &lt;span class="s2"&gt;=&lt;/span&gt; @line_id&lt;span class="s2"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: tnew, custom form&lt;/div&gt;
</description></item><item><title>TNEW Custom Form Stored Procedures</title><link>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures/revision/6</link><pubDate>Fri, 22 Jan 2021 10:09:59 GMT</pubDate><guid isPermaLink="false">fd08b0f2-65fa-4b2b-916a-cce3e88b61d0:96d78ec9-e8cf-4c9c-90c7-7ab5084c6a6b</guid><dc:creator>Nick Reilingh</dc:creator><comments>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures#comments</comments><description>Revision 6 posted to Community Docs Wiki by Nick Reilingh on 1/22/2021 10:09:59 AM&lt;br /&gt;
&lt;p&gt;The API is described here at the VERY BOTTOM of the page:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm"&gt;https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note that @line_id is&amp;nbsp;required on product-based custom forms, but not on a checkout survey form. @line_id means something different based on the product type that the form is being submitted on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Contribution: @line_id is the&amp;nbsp;ref_no, and can be looked up in dbo.T_WEB_CONTRIBUTION for the duration of the session.&lt;/li&gt;
&lt;li&gt;Performance (Ticket): @line_id is the li_seq_no, and can be looked up in dbo.T_WEB_LINEITEM&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;TIPS:&lt;/h2&gt;
&lt;p&gt;TO CONFIRM: If all of the fields in a form are optional, the stored procedure will NOT fire if the form is interacted with, but WILL fire if the form is interacted with, even if the state of the form is the same as when the page loaded.&lt;/p&gt;
&lt;p&gt;To suppress procedure functionality when the form is submitted empty, you must add conditional logic to your procedure.&lt;/p&gt;
&lt;p&gt;When switching from default CSI creation to stored procedure execution, a couple of data points that are supplied automatically on CSIs are not provided directly to the procedure, depending on the product type.&lt;/p&gt;
&lt;p&gt;For example, a custom form on a contribution saved to a CSI will include Contrib Type, Contrib Amount, Ref No (as Line Item ID), and Order Number by default in addition to the form fields, but when saving to a stored procedure, only @line_id is supplied along with the sessionkey and form fields.&amp;nbsp;If you need these other data points, you must fetch them yourself.&lt;/p&gt;
&lt;p&gt;Fetch Contrib Type Example:&lt;/p&gt;
&lt;pre class="p1"&gt;&lt;span class="s1"&gt;DECLARE&lt;/span&gt; @contrib_type &lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="s1"&gt;WITH&lt;/span&gt; semicolon_split &lt;span class="s1"&gt;AS &lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;SELECT&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ct_start &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;CHARINDEX&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s5"&gt;&amp;#39;c&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;+&lt;/span&gt; 1&lt;span class="s2"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ct_end &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;CHARINDEX&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s5"&gt;&amp;#39;_&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; dbo&lt;span class="s2"&gt;.&lt;/span&gt;T_WEB_ORDER&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s2"&gt;CROSS&lt;/span&gt; &lt;span class="s2"&gt;APPLY&lt;/span&gt; &lt;span class="s4"&gt;STRING_SPLIT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;notes&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s5"&gt;&amp;#39;;&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;WHERE&lt;/span&gt; sessionkey &lt;span class="s2"&gt;=&lt;/span&gt; @sessionKey&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="s2"&gt;AND&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s2"&gt;LIKE&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&amp;#39;%c%[0-9]\_[0-9]%&amp;#39;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s1"&gt;ESCAPE&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&amp;#39;\&amp;#39;&lt;br /&gt;&lt;span class="s2"&gt;),&lt;/span&gt; parsed &lt;span class="s1"&gt;AS &lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;SELECT&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;contrib_type &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;TRY_CONVERT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;SUBSTRING&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_start&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end &lt;span class="s2"&gt;-&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_start&lt;span class="s2"&gt;)),&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ref_no &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;TRY_CONVERT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;SUBSTRING&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end &lt;span class="s2"&gt;+&lt;/span&gt; 1&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;LEN&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;-&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end&lt;span class="s2"&gt;))&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; semicolon_split s&lt;br /&gt;)&lt;br /&gt;&lt;span class="s1"&gt;SELECT&lt;/span&gt; @contrib_type &lt;span class="s2"&gt;=&lt;/span&gt; contrib_type&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; parsed&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;WHERE&lt;/span&gt; ref_no &lt;span class="s2"&gt;=&lt;/span&gt; @line_id&lt;span class="s2"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: tnew, custom form&lt;/div&gt;
</description></item><item><title>TNEW Custom Form Stored Procedures</title><link>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures/revision/5</link><pubDate>Fri, 22 Jan 2021 10:09:04 GMT</pubDate><guid isPermaLink="false">fd08b0f2-65fa-4b2b-916a-cce3e88b61d0:96d78ec9-e8cf-4c9c-90c7-7ab5084c6a6b</guid><dc:creator>Nick Reilingh</dc:creator><comments>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures#comments</comments><description>Revision 5 posted to Community Docs Wiki by Nick Reilingh on 1/22/2021 10:09:04 AM&lt;br /&gt;
&lt;p&gt;The API is described here at the VERY BOTTOM of the page:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm"&gt;https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note that @line_id is&amp;nbsp;required on product-based custom forms, but not on a checkout survey form. @line_id means something different based on the product type that the form is being submitted on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Contribution: @line_id is the&amp;nbsp;ref_no, and can be looked up in dbo.T_WEB_CONTRIBUTION for the duration of the session.&lt;/li&gt;
&lt;li&gt;Performance (Ticket): @line_id is the li_seq_no, and can be looked up in dbo.T_WEB_LINEITEM&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;TIPS:&lt;/h2&gt;
&lt;p&gt;TO CONFIRM: If all of the fields in a form are optional, the stored procedure will NOT fire if the form is interacted with, but WILL fire if the form is interacted with, even if the state of the form is the same as when the page loaded.&lt;/p&gt;
&lt;p&gt;To suppress procedure functionality when the form is submitted empty, you must add conditional logic to your procedure.&lt;/p&gt;
&lt;p&gt;When switching from default CSI creation to stored procedure execution, a couple of data points that are supplied automatically on CSIs are not provided directly to the procedure, depending on the product type.&lt;/p&gt;
&lt;p&gt;For example, a custom form on a contribution saved to a CSI will include Contrib Type, Contrib Amount, Ref No (as Line Item ID), and Order Number by default in addition to the form fields, but when saving to a stored procedure, only @line_id is supplied along with the sessionkey and form fields.&amp;nbsp;If you need these other data points, you must fetch them yourself.&lt;/p&gt;
&lt;p&gt;Fetch Contrib Type Example:&lt;/p&gt;
&lt;pre class="p1"&gt;&lt;span class="s1"&gt;DECLARE&lt;/span&gt; @contrib_type &lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="s1"&gt;WITH&lt;/span&gt; semicolon_split &lt;span class="s1"&gt;AS &lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;SELECT&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ct_start &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;CHARINDEX&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s5"&gt;&amp;#39;c&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;+&lt;/span&gt; 1&lt;span class="s2"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ct_end &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;CHARINDEX&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s5"&gt;&amp;#39;_&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; dbo&lt;span class="s2"&gt;.&lt;/span&gt;T_WEB_ORDER&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s2"&gt;CROSS&lt;/span&gt; &lt;span class="s2"&gt;APPLY&lt;/span&gt; &lt;span class="s4"&gt;STRING_SPLIT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;notes&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s5"&gt;&amp;#39;;&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;WHERE&lt;/span&gt; sessionkey &lt;span class="s2"&gt;=&lt;/span&gt; @sessionKey&lt;br /&gt;&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="s2"&gt;AND&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s2"&gt;LIKE&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&amp;#39;%c%[0-9]\_[0-9]%&amp;#39;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s1"&gt;ESCAPE&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&amp;#39;\&amp;#39;&lt;br /&gt;&lt;br /&gt;&lt;span class="s2"&gt;),&lt;/span&gt; parsed &lt;span class="s1"&gt;AS &lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;SELECT&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;contrib_type &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;TRY_CONVERT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;SUBSTRING&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_start&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end &lt;span class="s2"&gt;-&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_start&lt;span class="s2"&gt;)),&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ref_no &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;TRY_CONVERT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;SUBSTRING&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end &lt;span class="s2"&gt;+&lt;/span&gt; 1&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;LEN&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;-&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end&lt;span class="s2"&gt;))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; semicolon_split s&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;span class="s1"&gt;SELECT&lt;/span&gt; @contrib_type &lt;span class="s2"&gt;=&lt;/span&gt; contrib_type&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; parsed&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;WHERE&lt;/span&gt; ref_no &lt;span class="s2"&gt;=&lt;/span&gt; @line_id&lt;span class="s2"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: tnew, custom form&lt;/div&gt;
</description></item><item><title>TNEW Custom Form Stored Procedures</title><link>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures/revision/4</link><pubDate>Fri, 22 Jan 2021 09:40:44 GMT</pubDate><guid isPermaLink="false">fd08b0f2-65fa-4b2b-916a-cce3e88b61d0:96d78ec9-e8cf-4c9c-90c7-7ab5084c6a6b</guid><dc:creator>Nick Reilingh</dc:creator><comments>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures#comments</comments><description>Revision 4 posted to Community Docs Wiki by Nick Reilingh on 1/22/2021 9:40:44 AM&lt;br /&gt;
&lt;p&gt;The API is described here at the VERY BOTTOM of the page:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm"&gt;https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note that @line_id is&amp;nbsp;required on product-based custom forms, but not on a checkout survey form. @line_id means something different based on the product type that the form is being submitted on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Contribution: @line_id is the&amp;nbsp;ref_no, and can be looked up in dbo.T_WEB_CONTRIBUTION for the duration of the session.&lt;/li&gt;
&lt;li&gt;Performance (Ticket): @line_id is the li_seq_no, and can be looked up in dbo.T_WEB_LINEITEM&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;TIPS:&lt;/h2&gt;
&lt;p&gt;TO CONFIRM: If all of the fields in a form are optional, the stored procedure will NOT fire if the form is interacted with, but WILL fire if the form is interacted with, even if the state of the form is the same as when the page loaded.&lt;/p&gt;
&lt;p&gt;To suppress procedure functionality when the form is submitted empty, you must add conditional logic to your procedure.&lt;/p&gt;
&lt;p&gt;When switching from default CSI creation to stored procedure execution, a couple of data points that are supplied automatically on CSIs are not provided directly to the procedure, depending on the product type.&lt;/p&gt;
&lt;p&gt;For example, a custom form on a contribution saved to a CSI will include Contrib Type, Contrib Amount, Ref No (as Line Item ID), and Order Number by default in addition to the form fields, but when saving to a stored procedure, only @line_id is supplied along with the sessionkey and form fields.&amp;nbsp;If you need these other data points, you must fetch them yourself.&lt;/p&gt;
&lt;p&gt;Fetch Contrib Type Example:&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;DECLARE&lt;/span&gt; @contrib_type &lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p2"&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;WITH&lt;/span&gt; semicolon_split &lt;span class="s1"&gt;AS &lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;/p&gt;
&lt;p class="p3"&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;SELECT&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ct_start &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;CHARINDEX&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s5"&gt;&amp;#39;c&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;+&lt;/span&gt; 1&lt;span class="s2"&gt;,&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ct_end &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;CHARINDEX&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s5"&gt;&amp;#39;_&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; dbo&lt;span class="s2"&gt;.&lt;/span&gt;T_WEB_ORDER&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s2"&gt;CROSS&lt;/span&gt; &lt;span class="s2"&gt;APPLY&lt;/span&gt; &lt;span class="s4"&gt;STRING_SPLIT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;notes&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s5"&gt;&amp;#39;;&amp;#39;&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;WHERE&lt;/span&gt; sessionkey &lt;span class="s2"&gt;=&lt;/span&gt; @sessionKey&lt;/p&gt;
&lt;p class="p4"&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="s2"&gt;AND&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s2"&gt;LIKE&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&amp;#39;%c%[0-9]\_[0-9]%&amp;#39;&lt;span class="s3"&gt; &lt;/span&gt;&lt;span class="s1"&gt;ESCAPE&lt;/span&gt;&lt;span class="s3"&gt; &lt;/span&gt;&amp;#39;\&amp;#39;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s2"&gt;),&lt;/span&gt; parsed &lt;span class="s1"&gt;AS &lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;/p&gt;
&lt;p class="p3"&gt;&lt;span class="s3"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;SELECT&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;contrib_type &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;TRY_CONVERT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;SUBSTRING&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_start&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end &lt;span class="s2"&gt;-&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_start&lt;span class="s2"&gt;)),&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;ref_no &lt;span class="s2"&gt;=&lt;/span&gt; &lt;span class="s4"&gt;TRY_CONVERT&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;int&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;SUBSTRING&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end &lt;span class="s2"&gt;+&lt;/span&gt; 1&lt;span class="s2"&gt;,&lt;/span&gt; &lt;span class="s4"&gt;LEN&lt;/span&gt;&lt;span class="s2"&gt;(&lt;/span&gt;s&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="s2"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;-&lt;/span&gt; s&lt;span class="s2"&gt;.&lt;/span&gt;ct_end&lt;span class="s2"&gt;))&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; semicolon_split s&lt;/p&gt;
&lt;p class="p5"&gt;)&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;SELECT&lt;/span&gt; @contrib_type &lt;span class="s2"&gt;=&lt;/span&gt; contrib_type&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;FROM&lt;/span&gt; parsed&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="s1"&gt;WHERE&lt;/span&gt; ref_no &lt;span class="s2"&gt;=&lt;/span&gt; @line_id&lt;span class="s2"&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: tnew, custom form&lt;/div&gt;
</description></item><item><title>TNEW Custom Form Stored Procedures</title><link>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures/revision/3</link><pubDate>Fri, 22 Jan 2021 09:35:17 GMT</pubDate><guid isPermaLink="false">fd08b0f2-65fa-4b2b-916a-cce3e88b61d0:96d78ec9-e8cf-4c9c-90c7-7ab5084c6a6b</guid><dc:creator>Nick Reilingh</dc:creator><comments>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures#comments</comments><description>Revision 3 posted to Community Docs Wiki by Nick Reilingh on 1/22/2021 9:35:17 AM&lt;br /&gt;
&lt;p&gt;The API is described here at the VERY BOTTOM of the page:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm"&gt;https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note that @line_id is&amp;nbsp;required on product-based custom forms, but not on a checkout survey form. @line_id means something different based on the product type that the form is being submitted on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Contribution: @line_id is the&amp;nbsp;ref_no, and can be looked up in dbo.T_WEB_CONTRIBUTION for the duration of the session.&lt;/li&gt;
&lt;li&gt;Performance (Ticket): @line_id is the li_seq_no, and can be looked up in dbo.T_WEB_LINEITEM&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;TIPS:&lt;/h2&gt;
&lt;p&gt;TO CONFIRM: If all of the fields in a form are optional, the stored procedure will NOT fire if the form is interacted with, but WILL fire if the form is interacted with, even if the state of the form is the same as when the page loaded.&lt;/p&gt;
&lt;p&gt;To suppress procedure functionality when the form is submitted empty, you must add conditional logic to your procedure.&lt;/p&gt;
&lt;p&gt;When switching from default CSI creation to stored procedure execution, a couple of data points that are supplied automatically on CSIs are not provided directly to the procedure, depending on the product type.&lt;/p&gt;
&lt;p&gt;For example, a custom form on a contribution saved to a CSI will include Contrib Type, Contrib Amount, Ref No (as Line Item ID), and Order Number by default in addition to the form fields, but when saving to a stored procedure, only @line_id is supplied along with the sessionkey and form fields.&amp;nbsp;If you need these other data points, you must fetch them yourself.&lt;/p&gt;
&lt;p&gt;Fetch Contrib Type Example:&lt;/p&gt;
&lt;div&gt;
&lt;pre&gt;  asdf&lt;/pre&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: tnew, custom form&lt;/div&gt;
</description></item><item><title>TNEW Custom Form Stored Procedures</title><link>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures/revision/2</link><pubDate>Fri, 22 Jan 2021 09:33:57 GMT</pubDate><guid isPermaLink="false">fd08b0f2-65fa-4b2b-916a-cce3e88b61d0:96d78ec9-e8cf-4c9c-90c7-7ab5084c6a6b</guid><dc:creator>Nick Reilingh</dc:creator><comments>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures#comments</comments><description>Revision 2 posted to Community Docs Wiki by Nick Reilingh on 1/22/2021 9:33:57 AM&lt;br /&gt;
&lt;p&gt;The API is described here at the VERY BOTTOM of the page:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm"&gt;https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note that @line_id is&amp;nbsp;required on product-based custom forms, but not on a checkout survey form. @line_id means something different based on the product type that the form is being submitted on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Contribution: @line_id is the&amp;nbsp;ref_no, and can be looked up in dbo.T_WEB_CONTRIBUTION for the duration of the session.&lt;/li&gt;
&lt;li&gt;Performance (Ticket): @line_id is the li_seq_no, and can be looked up in dbo.T_WEB_LINEITEM&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;TIPS:&lt;/h2&gt;
&lt;p&gt;TO CONFIRM: If all of the fields in a form are optional, the stored procedure will NOT fire if the form is interacted with, but WILL fire if the form is interacted with, even if the state of the form is the same as when the page loaded.&lt;/p&gt;
&lt;p&gt;To suppress procedure functionality when the form is submitted empty, you must add conditional logic to your procedure.&lt;/p&gt;
&lt;p&gt;When switching from default CSI creation to stored procedure execution, a couple of data points that are supplied automatically on CSIs are not provided directly to the procedure, depending on the product type.&lt;/p&gt;
&lt;p&gt;For example, a custom form on a contribution saved to a CSI will include Contrib Type, Contrib Amount, Ref No (as Line Item ID), and Order Number by default in addition to the form fields, but when saving to a stored procedure, only @line_id is supplied along with the sessionkey and form fields.&amp;nbsp;If you need these other data points, you must fetch them yourself.&lt;/p&gt;
&lt;p&gt;Fetch Contrib Type Example:&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: tnew, custom form&lt;/div&gt;
</description></item><item><title>TNEW Custom Form Stored Procedures</title><link>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures/revision/1</link><pubDate>Tue, 19 Jan 2021 20:52:47 GMT</pubDate><guid isPermaLink="false">fd08b0f2-65fa-4b2b-916a-cce3e88b61d0:96d78ec9-e8cf-4c9c-90c7-7ab5084c6a6b</guid><dc:creator>Nick Reilingh</dc:creator><comments>https://communitytest.tessitura.com/topical_groups/developers/w/community-developer-documentation/783/tnew-custom-form-stored-procedures#comments</comments><description>Revision 1 posted to Community Docs Wiki by Nick Reilingh on 1/19/2021 8:52:47 PM&lt;br /&gt;
&lt;p&gt;The API is described here at the VERY BOTTOM of the page:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm"&gt;https://www.tessituranetwork.com/TNEW_7/TNEW.htm#Topics/Form_Fields.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note that @line_id is&amp;nbsp;required on product-based custom forms, but not on a checkout survey form.&lt;/p&gt;
&lt;p&gt;TIPS:&lt;/p&gt;
&lt;p&gt;TO CONFIRM: If all of the fields in a form are optional, the stored procedure will NOT fire if the form is interacted with, but WILL fire if the form is interacted with, even if the state of the form is the same as when the page loaded.&lt;/p&gt;
&lt;p&gt;To suppress procedure functionality when the form is submitted empty, you must add conditional logic to your procedure.&lt;/p&gt;
&lt;p&gt;When switching from default CSI creation to stored procedure execution, a couple of data points that are supplied automatically on CSIs are not provided directly to the procedure, depending on the product type.&lt;/p&gt;
&lt;p&gt;For example, a custom form on a contribution saved to a CSI will include (?? fund, contrib_type, cont_amt ??), but when saving to a stored procedure, only @line_no is supplied. These other data points can be retrieved based on line_no by doing a lookup on T_WEB_CONTRIBUTION WHERE ref_no = @line_no.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: tnew, custom form&lt;/div&gt;
</description></item></channel></rss>