Skip to main content

I’ve added a “Add New Case” button to a detail view.
The Button has actions to:
- Add new row to the case data model
- Update the case data model RecordTypeId to the SObject  RecordType 18 char ID
(For this I made a model of the RecordType SObject, and “Case” as the Sobject Type Name which shows the record type name and record type ID)
(I tried this with an update model action hardcoded to the 18 char ID, and previously via a RecordType Model and a JS snippet)

Trying to save the record gives me a red error message saying “Could Not Match Reference to Record Type d:Record Type ID”

How do you pre-specify the record type?  For us, the record type is not a user selectable item.

Thanks

On the first action, set the default record type for the case to be the recordtype Id that you’d like.
fd8d9a51395f10b0a8354c907c36bd17d0052aa4.png


Thanks,  I tried something similar to that but it wasn’t working, not sure why. I deleted it all and got it working with:
592dd7da5bb00c7ef25553a475f4966d7aa5e2b7.png

Then I switched the action to run a snippet.
I didn’t like hardcoding the value (they change when you move between sandbox and production??) so I made another model to pull out the RecordType SObject for the “human readable” name of the record type, and made a snippet to run on the CaseData model when a new row was created:


var params = argumentsa0], $ = skuid.$, updates = params.updates; // Set new Case Record to the record ID in the first row CaseRecordType Model (limited to the desired item) var CaseRecordTypesModel = skuid.$M('CaseRecordTypes'); var CaseDataModel = skuid.$M('CaseData'); var recordTypeRecord = CaseRecordTypesModel.getFirstRow(); var caseDataRecord = CaseDataModel.getFirstRow(); var recordTypeId = recordTypeRecord.Id; console.log('found ID=' + recordTypeId); CaseDataModel.updateRow(caseDataRecord,'RecordTypeId',recordTypeId);<br>

Is this overkill? I’m 100% sure I’ll forget that I need to update the record type when we move to production (and I’ll have a lot of the hard coded values to update)

Thanks again.  Sometime’s it’s good to see that someone else got something working.


Ok, learned a lot this morning.  You don’t need no stinking snippet.

The Skuid merge template in Update value template can reference other models.
abe92b37574a25d6b785063a9b29617551a68293.png

This should be in the Skuid merge template documentation/samples on http://help.skuidify.com/m/11720/l/216661-skuid-template-syntax

I since saw it mentioned clearly on https://community.skuid.com/t/update-field-on-rows
But that was a bit over my head when I first saw it.

This with my CaseRecordTypes model to get the type I want works perfectly, and clearly.