Not getting the options for Option model for standard Whatid field of Task

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I have a table for Task(Standard Object) and I am displaying the WhatId (Standard field for Task) on the same. I need to have the What Id reference to Account Object. When I select Option Source for the field to be Model, it doesn't give me any option for the models for Account.
Photo of Mousumi

Mousumi

  • 202 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Is this what you want?

Photo of Mousumi

Mousumi

  • 202 Points 100 badge 2x thumb
Nope. We have 'option source' in the Search properties of the fields. When I select the Option source as Model, I should get options to select the model. But I don't see any option for Account Models
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Oh I see. You want to limit to only Accounts for the whatid?
Photo of Mousumi

Mousumi

  • 202 Points 100 badge 2x thumb
yes.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Here's the snippet you need for this for this as to be custom rendered.


// Define the possible target objects 
var targetObjects = ['Account']; 
// Render as a Picklist instead of an Autocomplete? 
var renderAsPicklist = false; 
var field = arguments[0], 
    value = skuid.utils.decodeHTML(arguments[1]), 
    metadata = field.metadata, 
    $ = skuid.$; 
if (field.mode == 'edit') { 
    // Limit the set of target objects 
    var targets = [], 
        uniqueTargets = {}; 
    $.each(metadata.referenceTo,function(i,r){ 
       if (($.inArray(r.objectName,targetObjects) != -1) && (!uniqueTargets[r.objectName])) { 
          targets.push(r); 
          uniqueTargets[r.objectName] = 1; 
          if (targets.length == targetObjects.length) return false; 
        } 
    }); 
    if (targets.length) { 
       // Make this field render as a picklist? 
       if (renderAsPicklist) field.options.type = 'REFPICK'; 
       // Override the current referenceTo 
       metadata.referenceTo.length = 0; 
       metadata.ref = $.map(targets,function(targ){return targ.objectName;}).join();
       metadata.referenceTo = targets; 
    } 
} 
// Run the standard renderer 
skuid.ui.fieldRenderers[metadata.displaytype][field.mode](field,value);