Skip to main content

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 = argumentsa0],value = skuid.utils.decodeHTML(argumentsa1]),$ = 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:Attva].Label , label:Attta].Label, defaultValue:Atta].IsDefault, active: true  });

        }


alert(‘Picklist’+ picklistEntries);


skuid.ui.fieldRenderersielement.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

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?


Reply