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
djordandjordan 

campaignMember status

Page 43 of the API 2.0 documentation states:

"During an inset or update, the sforce API verifies wheter the status field value specified in the call is a valid campaign member status for the given campaign. ... If the specified status value is not a valid campaign member status the API assigns the default campaign memeber status ... "

Is there any way to find the list of valid campaign member status fields for a specified campaign via the API?

 

D.

DevAngelDevAngel

Hi djordan,

Well, I was going to say it's a picklist that can be accessed via the describe call, but that does not seem to be the case.  From the looks of it, I'd say that currently, you can't determine the status values programatically.  Part of this seems to derive from the fact that in the Application you can establish different lists of campaign member statuses for each campaign.

This is a good question and needs to be released in the next release.

Ollie BOllie B

Hello DevAngel.

I am part of the development team currently attempting to implement this functionality.

You say that the current build of the API does not allow you to determine status values programmatically. I want to be 100% sure I understand what you mean when you say 'determine'.

If you already know their values can you 'change' these campaign member statuses programmatically? Which begs the question: is their an alternative way to determine these status values - through the SalesForce web interface for example?

Kind regards,

Ollie

Ollie BOllie B

Hi Dave

I've read your email and Ollie's reply and need to add the following.

On the Campaign Status we are clear that the API does not allow an update on the Status. In order to perform this we use insert and if it already exists and a valid staus value is used it then performs an update. (as described in your manual Chapter 6 Campaignmember)

We have interpreted your email as stating that we can't use the describe function to determine what the values are for a given set of campaign ststus programatically.

What we need to know is the specific values against a given set of status in order to do the aforementioned update. If we can't do it programically as you have stated can someone just look at the relevant table and tell us - can we look at the relationship between the pick list and its coresponding value?

We are trying to go live on a significant project for a large client and this is a major stumbling block that we need to resolve - your help is very much appreciated.

Matt

DevAngelDevAngel

Hi Ollie,

I'll try to clear the issue here.  If you run  the describe call for a campaign, you will see a field called status that is a picklist field that contains the possible statuses for a campaign.  These status values are managed (added, changed, removed) using the salesforce.com application.  These statuses are valid and appliciable to all campaigns.

Each campaign then, can have a set of statuses for campaignMembers that are independent of other campaigns.  Because the campaignMember statuses are actually an attribute of a campaign, they will not be represented in the describe call for a campaignMember.

Each campaign's campaignMember status list is managed through the salesforce.com application.  To modify the available campaignMember statuses you would log into salesforce.com and select the campaign you are interested from the campaign tab.  Along the top and bottom of the gray area that displays the details of the campaign there are several blue "buttons" used to manage the campaign.  If you click on the "Advanced Setup" button you will be taked to a screen that shows the current Member Status Values.  These are the values that I believe you are interested in.  As you can see from here, the Member Status Values are to a particular campaign. 

There is not currently a way to obtain these values as you can other picklist values used in salesforce.com.

I hope this is helpful, if not, let's try again.

 

Ollie BOllie B

Dave

Sorry no this is not the problem. . .

We are using the API to update a 'status' on a Campaignmember. As there is no 'update' function we are using 'insert' that if a Campaignmemebr exisits is treated as an update.

For example we have one status 'not visited' which is also set a 'default' and another 'visited' which also set responded flag to 'true' automatically.

The problem is that using the API to set the status to 'visited' etc., via the insert method.  When we check the record it always changes back to the default. This indicated that either the statuts value is other than as it appears in the pick list or something in the code is incorrect. Should we use the value as it appears in the pick list or is it different?

Your urgent reply would be appreciated.

Thanks for all your help

 

 

 

DevAngelDevAngel

Hi Ollie,

You should use the value as it is displayed in the pick list.  I am going to do some testing to see if there is a problem as yet undiscovered related to your observations.

Ollie BOllie B

Dave

We've tried all options here, all lowercase, uppers, uppers and lowers et al!

We know that we are hitting the correct campaignmember as we set an alternative status for a specific record using the saleforce.com interface (check it and its updated) and then did the same through the API to try and change it to a 3rd option and when we check it has changed from the alternative status back to the original default status.

I've read again the relevant page in the API Reference and it does state that if the stauts value is invalid it uses the default and therefore this does seem to be our problem. (Or is it!!)

If you do get it to work can you lets have the code so we can compare please.

Your continued support is much appreciated.

I hope you are able to fix this last problem for us so we can go live with our major activity.

regards

 

DevAngelDevAngel

Hi Ollie,

Well, I tried and it worked.  I initially inserted a compaignMember using a valid campaignID and leadID using a status of "crud".  This status is not in the list of valid campaignMember statues for the campaign.  The campaignMember was successfully created and the status was changed by the system to the default.  I then re-inserted the record modifying the status value to "Sent".  This status is valid.  Upon refreshing the lead in salesforce.com the status indicated "Sent".

Just for kicks, I added a new status called "Ollie" and again, re-inserted the campaignMember this time changing the record to use "Ollie" as the status.  Refreshing the lead shows the status as "Ollie".

I sent you an email asking you to call me.  Please check your email and we will figure out the problem.

C# implementation shown below.

sforceHelper.sForce.mapEntry[] record = new sforceHelper.sForce.mapEntry[3];

record[0] = new sforceHelper.sForce.mapEntry();

record[0].key = "campaignID";

record[0].value = "7013000000006Yl";

record[1] = new sforceHelper.sForce.mapEntry();

record[1].key = "leadID";

record[1].value = "00Q30000000asfC";

record[2] = new sforceHelper.sForce.mapEntry();

record[2].key = "status";

record[2].value = "Ollie";

try

{

Object ret = sfh.Insert("campaignMember", record);

}

catch (Exception ex)

{

System.Windows.Forms.MessageBox.Show("error: " + ex.Message);

}

sldringsldring

Hi Dave,

I am facing a similar problem like Ollie. I am trying to update the Status field in Campaigns, but it's showing me the deafult value only. After going through the series of discussions you had with Ollie, I tried creating the same record twice but it's still not working.

First time we enter the following lines of code

// Create the Campaign object as per the returned results

Campaign lookupCampaign = (Campaign) records[0].record;

// Create a new CampaignMember object that stores the mapping between Campaign and Lead

CampaignMember objCampaignMember = new CampaignMember();

// Assign the CampaignID and LeadID in the CampaignMember object

objCampaignMember.CampaignId = lookupCampaign.Id;

objCampaignMember.LeadId = LeadID;

objCampaignMember.Status = CampStatus;

// Create a new Salesforce object array and add the CampaignMember object to it

sObject[] arrCampMembers = new sObject[1];

arrCampMembers[0] = objCampaignMember;

// Call to create the Salesforce objects

SaveResult[] saveres = objBinding.create(arrCampMembers);

After this I am again creating the same record

//Re-Insert record for updating status field

CampaignMember objCampaignMember1 = new CampaignMember();

// Assign the CampaignID and LeadID in the CampaignMember object

objCampaignMember1.CampaignId = lookupCampaign.Id;

objCampaignMember1.LeadId = LeadID;

objCampaignMember1.Status = CampStatus;

// Create a new Salesforce object array and add the CampaignMember object to it

sObject[] arrCampMembers1 = new sObject[1];

arrCampMembers1[0] = objCampaignMember1;

// Call to create the Salesforce objects

SaveResult[] saveres1 = objBinding.update(arrCampMembers1);

This does not seem to help. Please respond !

Regards

A**bleep**a