Can't seem to use a Snippet as a Picklist Source on v2 Page

I have been banging my head against the wall trying to use a version of documentation to display a list of picklist values on a UI-Only field.

I’ve been following the documentation and confirmed that it works without any changes from v1 to v2. However, it doesn’t work when I try to run the same snippet (slightly modified) to render a picklist field instead of a table filter.

I’ve boiled it down to a very basic problem - it won’t console log the models ‘data’ property when I try it like so.

var RecordTypeModel = skuid.$M('OpportunityRecordTypes');
console.log(RecordTypeModel);
console.log(RecordTypeModel.data);

var picklistValues = []

return picklistValues;

I receive the following in console.log which doesn’t make any sense to me.
image
image

How does a log of the model show the data property with 2 items in the array and then immediately logging the data property itself show blank?!

I tested this on a v1 page and v2 and it’s only broken on v2.

Any idea what is happening behind the scenes that could be causing this and a possible workaround?

I believe this is a bug with Skuid Page Builder v2. Updated to the newest version, but still same problem.

Doesn’t make any sense that a console log of the model shows 2 rows in the ‘data’ property array. But, then when I console log the ‘data’ property directly it’s blank.

Only happens when trying to use snippet with UI-Only Picklist field. Here’s XML of the problem narrowed down. It will console log the array correctly if you have record types for Opportunity on a v1 page, but logs as 0 on a v2 page.

<skuid__page showsidebar="true" showheader="true" tabtooverride="Opportunity" personalizationmode="server">
	<background type="none"/>
	<models>
		<model id="Opportunity" limit="100" query="true" createrowifnonefound="false" sobject="Opportunity" datasource="salesforce">
			<fields>
				<field id="Name"/>
				<field id="CreatedDate"/>
				<field id="StageName"/>
				<field id="CloseDate"/>
				<field id="AccountId"/>
				<field id="Account.Name"/>
				<field id="Amount"/>
				<field id="RecordTypeId"/>
				<field id="RecordType.Name"/>
				<field id="testField" uionly="true" displaytype="PICKLIST" length="255" ogdisplaytype="TEXT" picklistsource="snippet" returntype="TEXT" snippet="getPicklistValues" label="testField"/>
			</fields>
			<conditions>
				<condition type="fieldvalue" value="" enclosevalueinquotes="true" field="StageName" state="filterableoff" inactive="true" name="StageName"/>
				<condition type="fieldvalue" value="" enclosevalueinquotes="true" field="RecordTypeId" state="filterableoff" inactive="true" name="RecordTypeId"/>
			</conditions>
			<actions/>
		</model>
		<model id="OpportunityRecordTypes" limit="" query="true" createrowifnonefound="false" sobject="RecordType" orderby="Name" datasource="salesforce">
			<fields>
				<field id="Name"/>
			</fields>
			<conditions>
				<condition type="fieldvalue" value="Opportunity" enclosevalueinquotes="true" field="SobjectType"/>
				<condition type="fieldvalue" value="true" enclosevalueinquotes="false" field="IsActive"/>
			</conditions>
			<actions/>
		</model>
	</models>
	<components>
		<skuid__table uniqueid="sk-2W4d-411" showListHeader="true" showListFooter="true" mode="edit" model="Opportunity" pageSize="10" showSaveCancel="true" rowHeightStrategy="fit" allowColumnHiding="true" allowSortingByColumn="false">
			<fields>
				<field id="testField"/>
			</fields>
			<filters/>
			<actions/>
			<massActions/>
			<rowActions/>
			<sorting/>
			<filtering enableSearch="true" searchMethod="server"/>
			<exportProperties useTableColumns="true" enableExportOptionOnTable="false"/>
		</skuid__table>
	</components>
	<resources>
		<javascript>
			<jsitem location="inlinesnippet" name="getPicklistValues" cachelocation="false" url="">const params = arguments[0];
var $ = skuid.$;
var RecordTypeModel = skuid.model.getModel('OpportunityRecordTypes');

console.log(RecordTypeModel);
console.log(RecordTypeModel.data);

var dummyArray = [];
return dummyArray;</jsitem>
		</javascript>
		<actionsequences/>
		<labels/>
	</resources>
</skuid__page>

Thanks for this report. I’ll look into this next week.