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
VikasVikas 

Can I access the "Status" picklist in "Add Campaign" feature through API?

While adding the campaing to a lead/contact, I am asked for the status which is "Sent" or "Responded".

Can I access this "Status" picklist through API? Does this resides in campaing member, but status field in campaingmember consists of a larger set of values. I mean the total of all values across all campaings - "Added through the 'Advanced Setup' on Campaign".

Please help me.

Thanks,

cmxintcmxint

Hi, Vikas!

As far as I got your question you need to access the set of all values of picklist field named "Status" in Campaign object. If so I can show you my way to achieve that. Following is the snippet with pocedure, which returns ArrayList object containing all the values from picklist field alone with one out parameter - "restrictedPL", which indicates whether this picklist restricted or not:


public ArrayList GetPickListValues(string table, string fieldName, out bool restrictedPL)

{

    ArrayList values = null;

    restrictedPL = false;

    DescribeSObjectResult dsr = bind.describeSObject(table); //get object structure

    foreach(Field field in dsr.fields)

    {

        if (field.name == fieldName)

        {

            if (field.picklistValues != null && field.picklistValues.Length > 0)

            {

                values = new ArrayList();

                restrictedPL = field.restrictedPicklist;

                for (int n=0; n<field.picklistValues.Length; ++n)

                    values.Add(field.picklistValues[n].value.ToString().ToUpper());

            }

            break;

        }

    }

    return values;

}


To achieve your point it's necessary to call

ArrayList values = GetPickListValues("Campaign", "Status", out restrictedPL);

 

Hope this makes sense
VikasVikas

Hi,

I do not want to access campaign. But when you hit advanced setup on campaign screen and then add the status of members attached to the campagin. This a picklist in **CampaingMember** not campaign.

 

I want to access this, but the total values.

Thanks,

 

ScotScot

Probably not much help - you'll need confirmation from the sf folks, but ...

It appears that the list of campaign member status values set by the advanced tab is not available through the API.  The picklist values returned from the describe of the campaign member include only Sent and Responded ... the two default values ... and none of those set via the advanced page.

This isn't too surprising ... for all practical usage, these values need to be dynamic, based on which campaign you're referencing. If you COULD retrieve them, they'd need to appear as data, rather than meta-data. That is, they wouldn't appear in a describe call.

I suspect that there is no global list, just these campaign-specific values stored in some special, non-API accessible spot.

cmxintcmxint

Hi Vikas!

I tried to run the code mentioned in my previous post and got four values from Status picklist of CampaignMember table:

    ArrayList arr = GetPickListValues("CampaignMember", "Status", out b);

while Scot told about only two values...

ScotScot

Interesting ...

What I did was slightly different, but should have been the equivalent ...

1)  In the sforce explorer, using the 5.0 endpoint, went to:
        CampaignMember / Fields / Status / type - picklist / Picklist Values
     which then showed me two values:
        Responded - Responded
        Sent - Sent

2) I picked two active campaigns ... both of which had only the two default member status values above.
    Using the Advanced tab, added a different third value to each.
       Campaign 1:  Sent, Responded, Test in Campaign 1
       Campaign 2:  Sent, Responded, Test in Campaign 2

In theory, I now have, globally, four different member status values.

3) Repeated step (1), and received the same two values.

I think, however, that the sforce explorer is using the same API interface that your GetPickListValues function is using.
I suspect that you've increased the global, or default, picklist values for CampaignMembers .. though it escapes me where this would be found.

What were your 4 values?

cmxintcmxint

Well, it's really interesting...

I used sFroce Explorer with the same endpoint (5.0) and navigate to "CampaignMember / Fields / Status / type - picklist / Picklist Values" which showed four values:

    Planned - Planned

    Received - Received

    Responded - Responded

    Sent - Sent

I didn't increase the global picklist values for CampaignMembers since I was just unable to find "Advanced tab" you mentioned in your post - what is that tab and where is it situated?

ScotScot

The advanced tab is really a button (sorry) named "Advanced Setup".

It's located on the campaign page .. that is, the page for an individual campaign. I suspect that it's there only if you have some type of "Marketing" permission.

It leads you to a "Campaign Member Status: [campaign-name]" page, which has a related list of "Member Status Values" with Edit and Replace buttons.

This is the set of values for an individual campaign. By experimentation, you can add any values you want for each campaign. However, all my campaigns start with default values of "Sent" and "Responded", which correspond to the global picklist values.

It appears that you have more global picklist values. I couldn't find where those are set. I thought perhaps they were the sum of all the values of individual campaigns (if so, they'd work for Vikas's request), but from empirical evidence, they are not.

cmxintcmxint

Yes, I got there now... But I saw only two values: "Sent" & "Responded" while describeSObject returns four values... So now I got the problem clearly. I tried to find out how to build global list of picklist values, but didn't succeeded. Seems to me - there is no way to fetch that values... Hope someone else could find the truth

DevAngelDevAngel

So, there is a lot of confusion around the campaign member status field.  I don't have the whole story, but I do have bits and pieces.

First, the part I don't have.  I don't know where the values that come up on the describe call are coming from.  There is a default set of statuses that exist "out of the box" and it is generally 4 items. 

To understand campaign member status from a metadata point of view it is important to keep in mind that the values entered in the Advanced Setup on an opportunity are specific to the opportunity.  This explains why the describe call doesn't jive with the values for CMS (campaign member status, tired of typing it out) on the opportunity.  The statuses entered there can be thought of as childern to the campaign. 

The CMS picklist is an extended picklist similar to the status on a lead.  For most picklists what we have is a simple key value pair (label and value).  For an extended picklist there may be more than 2 attributes and in the case of a CMS it is default and responded in addition to lable and value.

So, the bottom line is that you cannot currently obtain the list of valid CMS's for a particular campaign.  What needs to happen is a new object called CampaignMemberStatus nees to be exposed that includes, among other fields, a CampaignId.  When this object is exposed you can then query for the list of statuses using the Campaign Id as the criteria.

I filed a bug to have this feature enabled 4 or 5 months back, but it seems to have languished.  I have re-submitted this bug in the hopes that it is an easy mod so that we can get this feature prior to the next release.

Sorry for all the confusion and gnashing of teeth.  You guys sounded so sure that you were on the right track that I let you go on.  For that I apologize.

I hope this clears up the issue as it currently stands and look forward to announcing on this thread that we have provided a solution in the near future.

Cheers

ScotScot

Dave

Thanks --- I think you arrived at the same point, but stated it well - and confirmed the need for exposing an additional relationship to meet the original need by Vikas.

If anyone figures out where in the UI one establishes the default choices (the ones I have two of), I'd be interested.

Scot

 

VikasVikas

Thanks Dave, Thank you Scot.

My Bad, I can not put question the right way, it should not have taken this long thread.

Looking forward to next release of API.

Thanks,

CaptaConsultingCaptaConsulting
Hi,

Is that bug solved in the API 6.0?, i would like to access to this picklist "memberstatus" to get all the values for a specific campaign.

Are they other way to do this?

If it´s not solved... when do you think it will be developed?

Thanks a lot.

Best Regards.

Victor Alvarez