<?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>Default value in drop down field</title><link>https://community.appian.com/discussions/f/user-interface/18689/default-value-in-drop-down-field</link><description>Hi all, 
 I have a drop down field in my form: 
 a!dropdownField( label: &amp;quot;On Behalf&amp;quot;, labelPosition: &amp;quot;ADJACENT&amp;quot;, placeholderLabel: &amp;quot;--select one--&amp;quot;, choiceLabels: {&amp;quot;My Self&amp;quot;, &amp;quot;Someone Else&amp;quot;, &amp;quot;My Department&amp;quot;}, choiceValues: {&amp;quot;My Self&amp;quot;, &amp;quot;Someone Else&amp;quot;,</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Default value in drop down field</title><link>https://community.appian.com/thread/73629?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 19:49:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b7d98d23-8f6d-4bf5-bf5e-60c97c80b3b1</guid><dc:creator>nanfak</dc:creator><description>&lt;p&gt;Thanks Stewart,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Default value in drop down field</title><link>https://community.appian.com/thread/73628?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 19:48:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:38859806-6498-4ea1-9ea9-4ab04804ad02</guid><dc:creator>nanfak</dc:creator><description>&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Default value in drop down field</title><link>https://community.appian.com/thread/73627?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 19:48:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:71109784-932e-4455-9ad4-c65025eeb250</guid><dc:creator>nanfak</dc:creator><description>&lt;p&gt;Thanks Mike!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Default value in drop down field</title><link>https://community.appian.com/thread/73589?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 11:01:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3852b0d8-34f8-4abc-919a-c197ab7534e9</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;There are a couple of options here:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;you instantiate the CDT in the process BEFORE this form is generated (assuming this isn&amp;#39;t a process &amp;#39;Start Form&amp;#39;). You can then set the value of r&lt;span&gt;equestData.onBehalfType to &amp;#39;My Self&amp;#39;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;You instantiate&amp;nbsp;an instance of the CDT as a local variable, setting requestData.onBehalfType to &amp;#39;My Self&amp;#39;, manage the updates to the CDT in the local! variable and then only copy the CDT from local! to ri! at the point you submit the form&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Default value in drop down field</title><link>https://community.appian.com/thread/73585?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 07:26:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:00b09426-0180-4ec6-8271-3cf5f27296a2</guid><dc:creator>Harsh Kumar Agarwal</dc:creator><description>&lt;p&gt;As&amp;nbsp; described we can populate &amp;quot;My Self&amp;quot; by default in process instance before loading the form.&lt;br /&gt;Another way you can go with writing the code for dropdown as follows:&lt;/p&gt;
&lt;p&gt;value: if(isnull(&lt;span&gt;ri!requestData.onBehalfType&lt;/span&gt;), &amp;quot;My Self&amp;quot;, &lt;span&gt;ri!requestData.onBehalfType&lt;/span&gt;),&lt;/p&gt;
&lt;p&gt;saveInto: a!save(&lt;span&gt;ri!requestData.onBehalfType, save!value)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;and on form submit button:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;a!save(ri!requestData.onBehalfType, if(isnull(ri!requestData.onBehalfType), &amp;quot;My Self&amp;quot;,&amp;nbsp;ri!requestData.onBehalfType)).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The method suggested by Mike is much better in terms of performance but this one is also an alternative.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Default value in drop down field</title><link>https://community.appian.com/thread/73582?ContentTypeID=1</link><pubDate>Sun, 26 Apr 2020 22:41:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bfbfce9b-20a3-4b3b-841d-27aad0459251</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Oof, this one is *slightly* more complicated.&amp;nbsp; Basically if the CDT containing onBehalfType is empty at the start, there&amp;#39;s no very graceful way to pre-populate it at form load (just within the SAIL form) such that it shows the desired default value *and* saves it into the CDT - since user interaction of some sort is required to perform a save.&lt;/p&gt;
&lt;p&gt;By far the easiest method here might be to simply have the process instance set a default value of &amp;quot;My Self&amp;quot; in the running process before the user hits that form.&amp;nbsp; That way, the form will show the desired default value *and* the data in your CDT will have the same.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>