multiple default values for a multipicklist UI field

  • 1
  • Question
  • Updated 2 years ago
  • Answered
Hello all,

is there a way to set multiple default values for a multi-select picklist UI field?

Cheers,

Ben.
Photo of Ben Murray

Ben Murray

  • 1,084 Points 1k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Ben Murray

Ben Murray

  • 1,084 Points 1k badge 2x thumb
Is there anyone who can help? Cheers, Ben
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Not exactly.

This is a salesforce limitation, not a squid one.

You can 'cheat' with a custom field renderer, however:

var field= arguments[0], value = skuid.utils.decodeHTML(arguments[1]),
  $ = skuid.$;
// If there isn't a value, then make the value our 'default'
if (!value) {
  value = //this should be a semicolon delineated string
  field.model.updateRow(field.row, field.id, value, {initiatorId: field._GUID});
  // if you want to save...
  field.model.save();
}
//Render
skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value);
Photo of Ben Murray

Ben Murray

  • 1,084 Points 1k badge 2x thumb
matt, thank you - I'm just learning about Skuid - where do I use this code (with the necessary changes)? Cheers, Ben.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
This is a custom field renderer. Create a new javascript snippet on your page, name it something reasonable, and paste the code above into the snippet. Then click on the field and change the rendering options to 'Custom' and type in the name of your snippet.
Photo of Ben Murray

Ben Murray

  • 1,084 Points 1k badge 2x thumb
Matt - worked like a charm - thank you - that makes a big difference at this end. Ben