+ Start a Discussion
Venkat Reddy 6Venkat Reddy 6 

Multi Select PickList in Javascript Button

Hi All,
I've a requirement, where i need to have the value persisting in the Multiselect picklist value. To be clear with the message, i would like to check if the Value in the multi picklist is BLANK or Not.

Here is the sample code, i've been trying in trial sandbox.
------------------------------------

{!Account.Multi_Test__c}{!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/24.0/apex.js")} 
var a = new sforce.SObject("Account");
a.Id = '{!Account.Id}';
var b = '';
b = '{!Account.Multi_Test__c}';
alert('dddddd --> '+b);
if(b!= null || b!= '' )
{
alert('multi select is not empty');
a.status__c = 'Closed';
result = sforce.connection.update([a]);
location.reload();
}
else{
  alert('multi select is empty');
}
------------------------

Where, Multi_Test__c is a multi select picklist field with some values say..a,b,c,d,.. and Status__c is a picklist field with lovs Open,closed, in-progress. both these fields are on account
I alert returns"multi select is not empty", and i never the alert "multi select is empty".

PLEASE SUGGEST...
Thanks in Advance

Venkat
William TranWilliam Tran
Why don't you add the multilist in your alert to see what value is display, that way you can easily debug and find the issue.

thx

use:

 alert('multi select is not empty: '+b);


 alert('multi select is empty: '+b);