JFDu / salesforce-dotnet

Automatically exported from code.google.com/p/salesforce-dotnet
0 stars 0 forks source link

Creating a new Campaign, but not display on Salesforce. #14

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

Campaign objCampaign = new Campaign();
objCampaign.Name = txtAccountSearch.Text;            
string addedCampaignId = new CampaignController().Add(objCampaign);
-------------------------------------------------------------------

  public class CampaignController : SforceControllerBase
    {
        public string Add(Campaign objCampaign)
        {
            sObject[] arrayCampaign = new sObject[1];
            arrayCampaign[0] = objCampaign;

            SaveResult[] saveResults = SforceProvider.Instance.Add(objCampaign);

            for (int i = 0; i < saveResults.Length; i++)
            {
                // Determine whether create() succeeded or had errors  

                if (saveResults[i].success)
                {
                    return saveResults[i].id;
                }
                else
                {
                    // Handle the errors  

                    foreach (Error error in saveResults[i].errors)
                    {
                        return "Error message: " + error.message;
                    }
                }
            }

            return "";
        }
    }

What is the expected output? What do you see instead?

i want to see this entry into Sales force.

What version of the product are you using? On what operating system?

windows xp with same version

Please provide any additional information below.

Original issue reported on code.google.com by jinda...@gmail.com on 13 Jan 2011 at 10:18

GoogleCodeExporter commented 8 years ago
Can you please provide any Exceptions, or the SaveResult at least?

I would also review:

 - Campaign object http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_campaign.htm#topic-title
 - CampaignMember objects http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_campaignmember.htm#topic-title

Both objects have some properties that need to be set I believe. Last I worked 
with them, e.g.

You will also need to review your version of Salesforce and its features, the 
Campaign object is defined only for those organizations that have the marketing 
feature enabled and valid marketing licenses. In addition, it is accessible 
only to those users (verify the API user can access) that are enabled as 
marketing users. If the organization does not have the marketing feature or 
valid marketing licenses, this object does not appear or is inaccessible.

Original comment by mteece@gmail.com on 15 Jan 2011 at 12:03