Preload a UI Only reference Field

Bill Fox
Bill Fox 💎
edited July 6, 2020 in Questions

Are there any screens shots to show how to load a record into a UI Only reference field when creating a record. Here is what I have done in V2:


Comments

  • Hey Bill, thanks for the video. I've been able to reproduce this issue in v2 and it appears there's an issue in how the values are being handled by the ui-only reference field. I am logging this as a known issue in our tracking system. We will let you know when the fix is available.

    In the meantime it will help us prioritize this issue if you could share more about how your implementation is affected:

    • Is this page already live in production? 
    • If this page isn't already live, when is your planned deployment date? 
    • Is this issue blocking that deployment?

    I've assessed this issue's level of impact on you as Level 4 Medium Impact. Let me know if this sounds correct.

  • Thanks Anna. It is not live. The impact level is correct.

  • Hey Bill, just wanted to let you know that I've been looking into this with the product team.

    For now if you have the record name stored in another model, you can use the field "Placeholder" value to bring in the name of the record. Alternatively, you could use a reference field from a real object as a Ui-Only reference field - just have the model query no data, create a new row, and don't save any changes.

    Here's a simple page demonstrating both ways:

    <skuid__page unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true">
    
    	<models>
    
    		<model id="Account" limit="1" query="true" datasource="salesforce" sobject="Account">
    
    			<fields>
    
    				<field id="RecordTypeId"/>
    
    				<field id="RecordType.Name"/>
    
    				<field id="Id"/>
    
    				<field id="Name"/>
    
    			</fields>
    
    			<conditions/>
    
    			<actions>
    
    				<action>
    
    					<actions>
    
    						<action type="createRow" model="UiOnly2" appendorprepend="prepend" defaultmodefornewitems="edit" affectedrows="context">
    
    							<defaults>
    
    								<default valuesource="fieldvalue" field="Reference" fieldtargetobjects="Account" enclosevalueinquotes="true" value="{{Id}}"/>
    
    							</defaults>
    
    						</action>
    
    					</actions>
    
    					<events>
    
    						<event>models.loaded</event>
    
    					</events>
    
    				</action>
    
    			</actions>
    
    		</model>
    
    		<model id="UiOnly" limit="20" query="true" datasource="Ui-Only" createrowifnonefound="true">
    
    			<fields>
    
    				<field id="Reference" displaytype="REFERENCE" length="255" ogdisplaytype="TEXT" datasource="salesforce" targetobjects="Account" keyfield="Id" defaultvaluetype="">
    
    					<batchfields>
    
    						<batchfield field="Name"/>
    
    					</batchfields>
    
    				</field>
    
    				<field id="AccountId" displaytype="TEXT" length="255" defaultvaluetype="fieldvalue"/>
    
    				<field id="AccountName" displaytype="TEXT" length="255" defaultvaluetype="modelmerge" defaultValue="" model="Account" enclosevalueinquotes="true" mergefield="Name"/>
    
    			</fields>
    
    			<conditions>
    
    				<condition type="modelmerge" value="" field="Reference" fieldtargetobjects="Account" operator="=" model="Account" enclosevalueinquotes="true" mergefield="Name" novaluebehavior="deactivate"/>
    
    				<condition type="modelmerge" value="" field="Account.Name" operator="=" model="Account" enclosevalueinquotes="true" mergefield="Name" novaluebehavior="deactivate"/>
    
    			</conditions>
    
    			<actions/>
    
    		</model>
    
    		<model id="ContactUsedasUIOnly" limit="20" query="false" createrowifnonefound="true" datasource="salesforce" sobject="Contact">
    
    			<fields>
    
    				<field id="AccountId"/>
    
    				<field id="Account.Name"/>
    
    			</fields>
    
    			<conditions>
    
    				<condition type="modelmerge" value="" field="AccountId" fieldtargetobjects="Account" operator="=" model="Account" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="deactivate"/>
    
    			</conditions>
    
    			<actions/>
    
    		</model>
    
    	</models>
    
    	<components>
    
    		<skuid__grid uniqueid="sk-1hiQ-4518" flexDirection="row" justifyContent="flex-start" alignItems="flex-start" columnGutter="5">
    
    			<divisions>
    
    				<division alignSelf="auto" minWidth="100px" ratio=".5">
    
    					<components>
    
    						<skuid__form showErrorsInline="true" model="Account" uniqueid="sk-1NyW-6697" mode="read">
    
    							<renderConditions logictype="and"/>
    
    							<styleVariantConditions/>
    
    							<columns>
    
    								<column verticalAlign="top" ratio="1">
    
    									<sections>
    
    										<section title="Account data: {{Name}}" showHeading="false">
    
    											<fields>
    
    												<columns>
    
    													<column verticalAlign="top" ratio="1" behavior="flex" minWidth="100px">
    
    														<sections>
    
    															<section showHeading="false">
    
    																<fields>
    
    																	<skuid__field id="Id" uniqueId="sk-1NyW-6700"/>
    
    																	<skuid__field id="Name" uniqueId="sk-3Kpi-53162"/>
    
    																</fields>
    
    															</section>
    
    														</sections>
    
    													</column>
    
    												</columns>
    
    											</fields>
    
    										</section>
    
    									</sections>
    
    								</column>
    
    							</columns>
    
    						</skuid__form>
    
    					</components>
    
    				</division>
    
    				<division minWidth="100px" ratio="2" alignSelf="auto">
    
    					<components>
    
    						<skuid__form showErrorsInline="true" model="UiOnly" uniqueid="sk-3Kqr-14980" mode="edit">
    
    							<columns>
    
    								<column verticalAlign="top" ratio="1" behavior="flex" minWidth="100px">
    
    									<sections>
    
    										<section title="Ui-Only Reference populated with condition + &quot;Default Items&quot; + Placeholder">
    
    											<fields>
    
    												<columns>
    
    													<column width="100%" behavior="flex" verticalAlign="top" ratio="1" minWidth="100px">
    
    														<sections>
    
    															<section title="New Section" showHeading="false">
    
    																<fields>
    
    																	<skuid__field id="Reference" uniqueId="sk-3Kqr-14981" pageSize="5" tokenizeSearch="false" label="Reference (should show {{$Model.Account.data.0.Name}})" displayTemplate="{{Name}}" searchTemplate="{{Name}}" placeholder="{{$Model.Account.data.0.Name}}">
    
    																		<filters/>
    
    																		<searchFields/>
    
    																		<renderConditions logictype="and" onhidedatabehavior="keep"/>
    
    																		<enableConditions logictype="and"/>
    
    																		<styleVariantConditions/>
    
    																	</skuid__field>
    
    																</fields>
    
    															</section>
    
    														</sections>
    
    													</column>
    
    												</columns>
    
    											</fields>
    
    										</section>
    
    									</sections>
    
    								</column>
    
    							</columns>
    
    							<styles>
    
    								<spacing top="2"/>
    
    							</styles>
    
    						</skuid__form>
    
    						<skuid__form showErrorsInline="true" model="ContactUsedasUIOnly" uniqueid="sk-3um1-13620" mode="edit">
    
    							<columns>
    
    								<column>
    
    									<sections>
    
    										<section title="Contact Model Used as UI Only">
    
    											<fields>
    
    												<skuid__field id="AccountId" uniqueId="sk-3um1-13621" tokenizeSearch="false"/>
    
    											</fields>
    
    										</section>
    
    									</sections>
    
    								</column>
    
    							</columns>
    
    						</skuid__form>
    
    					</components>
    
    				</division>
    
    			</divisions>
    
    			<styles>
    
    				<spacing left="2" right="2"/>
    
    			</styles>
    
    		</skuid__grid>
    
    	</components>
    
    	<resources>
    
    		<labels/>
    
    		<javascript/>
    
    		<css/>
    
    		<actionsequences>
    
    			<actionsequence id="d63e45ba-22b0-48a1-90b0-d18c99322e06" label="New sequence" type="reusable">
    
    				<description/>
    
    				<actions>
    
    					<action type="updateRow" fieldmodel="UiOnly1" affectedrows="context">
    
    						<updates>
    
    							<update valuesource="modelmerge" field="Reference" fieldtargetobjects="Account" enclosevalueinquotes="true" sourcemodel="Account" sourcefield="Id"/>
    
    						</updates>
    
    					</action>
    
    				</actions>
    
    			</actionsequence>
    
    		</actionsequences>
    
    	</resources>
    
    	<styles>
    
    		<styleitem type="background" bgtype="none"/>
    
    	</styles>
    
    </skuid__page>
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!