function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JLHJLH 

Setting Picklist to null

I want to create a Detail Page Link that set a custom Picklist value of the Contacts to the same custom Picklist value in an account.  That code is simple:
records[i].field__c = '{!Account.field__c}';
 
and setting to null is simple:
 
 records[i].field__c = null;
 
The problem I am having is writing a function that can do both.  I know I need to check the field__c value but I'm not sure how.
 
Thanks in advance. 
mojeebahmedmojeebahmed
Hi,

    May be this could help.

    var picklistfieldvalue = '{!Account.Field__c}';

    if(picklistfieldvalue == "" )
    {
       records[i].field__c = null;
    }
    else
    {
       records[i].field__c = '{!Account.field__c}';
    }