How do I use the isAvailable() property on the Record Type Metadata Object?

Trying to filter record types in the record type model based on what the logged in user has access to.  We are trying to accomplish this by querying all record types in the model, then looping through each row in the model and checking to see if the user has access to that particular row.  Can we use isAvailable() in this scenario?  If so, how do we use it?  We haven’t had any luck finding an example in the community or online.  

Any help is appreciated! 

We have tried 
for(recordType of recordTypeModel.getRows()){
  if(!recordType.isAvailable){
     recordTypeModel.abandonRow(recordType);
  }
}

in this case recordType.isAvailable is undefined

Hi, Erick.  Did you ever figure this out?  I am also trying to use the isAvailable property (documented here) and getting stuck.

So this is pretty old, but I came back to this recently and figured out how to use isAvailable to generate the correct record type picklist for a given user.  This uses a custom field renderer snippet on the Record Type field.  Sharing it here in case it helps others, or if anyone has suggestions for improving.  For example, there is probably a better way to handle the fact that this won’t work unless it is called as the field renderer from the RecordTypeID field.  Also, I set the field to required, but not sure how to have it show with the red border.  I am not so experienced with custom field renderers, so I used the example here as a starting point (thanks, J!).  Suggestions welcome!

The below is from a static resource snippet setup, so might need to be adjusted for inline snippets.

( function( skuid, $ ){ var snippet = skuid.snippet, ui = skuid.ui; snippet.registerSnippet( 'availableRecordTypesPicklist', function(){ var field = arguments[0], value = arguments[1], fieldName = field.id, model = field.model, row = field.row; // Proceed if this renderer was called from record type field if( fieldName == 'RecordTypeId' ){ if( field.mode === 'edit' ){ // Build picklist options var availRecTypes = []; // Loop through each record type in the field's model $.each( model.recordTypeInfos, function( i, rt ){ // Build list of record types available to the user (except the master) if( rt.isAvailable && ( rt.isMaster == undefined || !rt.isMaster ) ){ availRecTypes.push({ value : rt.recordTypeId, // Will be stored in target object label : rt.name // Will display in picklist }); } }); // Render the options as a PICKLIST var availRecTypesPicklist = ui.renderers.PICKLIST.edit({ entries : availRecTypes, required : true, value : value }).change( function(){ // Update the row in the target object model.updateRow( row, fieldName, $( this ).val() ); }); // Append the PICKLIST to the DOM element field.element.append( availRecTypesPicklist ); } else { // If the mode is anything other than edit, display the field as Text ui.fieldRenderers.TEXT[ field.mode ]( field, model.getFieldValue( row, 'RecordType.Name' ) ); } } else { // If renderer not called from record type field, warning message console.log( 'This custom field renderer must be called from record type field' ); } }); }( skuid, skuid.$ ));

I’m glad you came back and posted this because I was just looking for this kind of solution today, I found your post and was able to implement it! 

I am having one issue—when I load the page, the RecordTypeId field is rendered blank for the first item (and correctly for the remaining). When I go into Edit mode the picklist is there and populated appropriately with the correct item selected. If I add a new item to the list in-line, they all appear appropriately after clicking Save.

If I add code to the function to log every time I enter the function, I can see that the function runs n-1 times where n is the number of list items. Conversely, when it reloads after adding a new line item it runs n times.

Any thoughts? I am fairly new to Skuid. Thanks in advance!