SalesForce not setting dependent fields from .Net API

I am setting values on an object from .Net via the API. One of the values I’m setting is a picklist value that has several dependent fields. The dependent fields are not getting set based on the value I’m specifying for the picklist. Is there a way I can make this work?

Answer

Dependent picklists are only a visual guideline, active in the web interface and respected by mobile apps. The fact that you select something on controlling picklist and it limits the “slave” to just 1 option doesn’t mean that the slave will automatically get that value. There’s still choice between “that only possibility” and null.

Sure, you could force the picklist to be required on page layout. But again – that’d be visual only. You can’t mark the picklist fields required on database level.

From API point of view the picklists are just string fields (NVARCHAR if you like; no idea what’s the limit, certainly more than 255 chars is possible – not that it’s a good idea).

You can type whatever you want to them and if there are no validation rules, trigger-based checks or workflows that overwrite it – it should save just fine.


I see 3 options:

  1. fetch the picklist dependencies info and reconstruct the logic in your .NET app:

  2. Duplicate the logic in SF (workflow rules, triggers). There’s a limit on how many workflow rules can be on an object, they can really make debugging hard… and trigger means you need to deploy changes to SF every time you want to modify the relations.

  3. Drop the picklists and go with lookup fields, they can have filters on them and adding new entries to “dictionary” can become a task for some “Product Manager” as opposed to sending tickets to IT 3 times a week to modify the dependencies…

Attribution
Source : Link , Question Author : Nancy Benigni , Answer Author : Community

Leave a Comment