Any tips - Task Model, Who Id (Assigned To) field should render User, Partner User as pick list

  • 1
  • Question
  • Updated 3 years ago
Want to make Assigned To field on Task, should point Partner User, User instead of Lead, Contact.

We have followed the reference

"https://community.skuidify.com/skuid/topics/can_i_limit_which_objects_are_possible_targets_of_polymo..."  _ as well followed the given proceedures such as

1) creating inline snippet
2) using that snippet for custom field renderer

But it doesn help us the way we expect.  Any help with this asap will be appreciated.  Thanks.
Photo of Vijay Rmaesh

Vijay Rmaesh

  • 210 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Vijay,

Can you post your snippet so we can take a look?
Photo of Vijay Rmaesh

Vijay Rmaesh

  • 210 Points 100 badge 2x thumb
Hi Matt,

Thanks for your reply.  Please find the below snippet which i tried for custom field renderer.
-----------------------------------------------------------------------------------------------------------------------------

//// CONFIGURATION 
// 
// Define the possible target objects 
var targetObjects = ['Account', 'Opportunity']; 
// 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); 
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Very first line.  You have not defined appropriate TargetObjects.  I think you need to use PartnerUser and User.  

What I don't know is whether those two objects are allowed for the Assigned To polymorphic field. 
Photo of Vijay Rmaesh

Vijay Rmaesh

  • 210 Points 100 badge 2x thumb
@Rob Hatch Just for testing i gave TargetObjects as Account, Opportunity.  Still even it is not changing from Contacts, Leads.  Thats what the problem.  I should have put in already, it s my mistake.

Any help would be appreciated.
Photo of Vijay Rmaesh

Vijay Rmaesh

  • 210 Points 100 badge 2x thumb
@Rob Hatch  in usual salesforce Task Assigned to would be users only, means users, partner users like that.  But in skuid task assigned to is challenge facing.  Thats where i required help
(Edited)
Photo of Vijay Rmaesh

Vijay Rmaesh

  • 210 Points 100 badge 2x thumb
@Rob Hatch Just for testing i gave TargetObjects as Account, Opportunity.  Still even it is not changing from Contacts, Leads.  Thats what the problem.  I should have put in already, it s my mistake.

Any help would be appreciated.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I'm now very confused.  You are correct that Assigned to field usually only allows you to assign users.  Is this a custom relationship field or just the standard one?  Does this specific field work correctly in a standard layout?  I think there is somthing more fundamental going on than what can be solved with the custom renderer. 
Photo of Vijay Rmaesh

Vijay Rmaesh

  • 210 Points 100 badge 2x thumb
@Rob Hatch, yes you are right, it works fine with standard salesforce layout.  To get you more clarity in this.  Salesforce Set Up-> Activities -> Task Fields -> Assigned To (Who Id) look up with Contact. Lead.  This is what shows in the Skuid.  To Solve this, we have used above given skuid js script to render in Assigned To field.  But it wasnt wrk.

Could you please help me.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
If the base configuration binds the Who Id to Contact and Lead,  Skuid will NOT be able to change that binding using Javascript.  You will have to change that in the core setup.  All Skuid can do is limit the options that have been detailed in setup.