"Can not read metaData of undefined" (Tries to push the CampaignMemberStatus label to Status field o

edited May 17, 2019 in Questions
Skuid Page create on Campaign Tab, and At SubTab level showing Campaign members. 

There, we have status field which we want to push the values from CampaignMemberStatus - "Label" field.

Create inline snippet for same  - 

    var element = arguments[0],value = skuid.utils.decodeHTML(arguments[1]),$ = skuid.$;
    console.log('#####'+ arguments[0]);

//Get Campaign Member model information
    var campMembermodel = skuid.model.getModel("CampaignMembers");
    //Fetch first row of Lead info.
    var raw= campMembermodel.getFirstRow();
    // Get Status field value
    var statusModel=raw.Status;
   alert('#####'+ statusModel);
 console.log('I am in CampMember Snippet');
    // Perform query on Campaign Member Status on basis of CampaignId
    var result = sforce.connection.query("SELECT Id,Label,CampaignId,IsDefault,HasResponded From CampaignMemberStatus where CampaignId = '7012G000001Fh8B'");
    var Att = result.getArray("records");
    console.log('Length'+ Att);

  // Create a array for Custom Picklist
var picklistEntries = [];

picklistEntries = element.metadata.picklistEntries;

// if you don't do this, then the "real" values are already in the picklist and the code below will add duplicate values
picklistEntries.length = 0;     

        for(var a=0;a<Att.length;a++){
            picklistEntries.push({ value:Att[a].Label , label:Att[a].Label, defaultValue:Att[a].IsDefault, active: true  });

alert('Picklist'+ picklistEntries);



Error I am getting in console log - "Can not read metadata of undefined" for this line - picklistEntries = element.metadata.picklistEntries;

Can you please help us the same asap.



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!