Skip to main content
Nintex Community Menu Bar
Question

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

  • July 11, 2024
  • 1 reply
  • 11 views

Forum|alt.badge.img+1

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);
    
    if(Att.length!==0)
{

  // 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);

skuid.ui.fieldRenderers[element.metadata.displaytype]element.mode;

}

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.

thanks

1 reply

Forum|alt.badge.img+6

Hi Rajat, we were also looking into this and were wondering if this should be a workaround for your other issue that you posted here: https://community.skuid.com/t/status-field-value-not-visible-in-skuid-campaign-member-page
If yes, maybe we can solve your other issue together and this JS is longer necessary for your page.
If not, were do you use this field, as a field renderer?