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
Antonio_hotelbedsAntonio_hotelbeds 

Javascript copying multipicklist field

Hi all,

 

I have created a custom button that will map the fields from the lead to my custom object Groups. The problem is that the multipicklist field are not being copied. This is the code in JavaScript:

 

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}

var updateRecords = []; //array for holding records that this code will ultimately update

var Grupo = new sforce.SObject("Group__c");
Grupo.Agent__c="{!Lead.Agent__c}";
Grupo.Name="{!Lead.Group_enquiry_number__c}";
Grupo.Group_Source_Market__c="{!Lead.Group_Source_Market__c}";
Grupo.Type_of_Group__c="{!Lead.Type_of_Group__c}";
Grupo.Country_Groups__c="{!Lead.Country_Groups__c}";
Grupo.Destination_Groups__c="{!Lead.Destination_Groups__c}";
Grupo.Region_Groups__c="{!Lead.Region_Groups__c}";
Grupo.Alternative_Destinations__c="{!Lead.Alternative_Destinations__c}";

Grupo.Number_of_Nights__c="{!Lead.Number_of_Nights__c}";
Grupo.Expected_Budget__c="{!Lead.Expected_Budget__c}";
Grupo.Name_of_Hotel__c="{!Lead.Name_of_otel__c}";
Grupo.Type_of_Accommodation__c="{!Lead.Type_of_Accomodation__c}";
Grupo.Category__c="{!Lead.Category__c}";
Grupo.Board_Type__c="{!Lead.Board_Type__c}";

 

//Query to get the account that group will be related to
var cliente= sforce.connection.query("Select Id from Account where AccountNumber='{!Lead.Atlas_Number__c}' and Atlas_Branch_Number__c={!Lead.Branch__c} limit 1");
records = cliente.getArray("records");
for (var i=0; i<records.length; i++) {
var record = records[i];
Grupo.Account_Name__c=record.Id;
}

 

var result = sforce.connection.create([Grupo]);

window.location.reload();

 

 

For example, the field Board_Type__c in the lead and in the group object is a multipicklist, and the content of it doesnt map between the lead and the group object.

 

Does anyone know the reason and a solution?

 

thanks,

 

Antonio