0

How do i send this set of unique data to Salesforce using Visual Studio 2013 and in C# if that helps. My code and a picture are below. Im kinda of lost. been trying to figure this out for a few hours and ive got a headache. Please help! thanks!

MY QUESTION: How do i Create a user using the Text Boxes Below, a Submit Button, and C# Code? I want to be able to go onto test.salesforce.com, goto Manage Users, and be able to see the user i just created from this program.

This is the Data i'm trying to send

        Lead sfdcLead = new Lead();

        string firstName = txtFirstName.Text;
        string lastName = txtLastName.Text;
        string email = txtEmail.Text;
        string role = lstRole.Text;
        string userLicense = lstUserLicense.Text;
        string profile = lstProfile.Text;

        sfdcLead.FirstName = firstName;
        sfdcLead.LastName = lastName;
        sfdcLead.Email = email;           

        SaveResult[] saveResults = Sfdcbinding.create(new sObject[] { sfdcLead });

        if (saveResults[0].success)
        {
            string Id = "";
            Id = saveResults[0].id;
        }
        else
        {
            string result = "";
            result = saveResults[0].errors[0].message;
        }
3
  • Your question is not clear. Your screen shows lots of data (Users, Profiles, Groups etc) but your example shows a lead. Can you please explain what you are trying to do?
    – datasert
    Commented Feb 24, 2015 at 21:33
  • How do I create a user using the Text Boxes above and then send that data to salesforce so that if i was on test.salesforce.com and i click manage users i can see the new user that was created?
    – Jonathan
    Commented Feb 24, 2015 at 21:35
  • Take a look at salesforce.com/developer/docs/api . Update() and query() are the way to go. Commented Feb 24, 2015 at 21:43

2 Answers 2

1

To create users in Salesforce from an external client (in this case your C# app), you will need to use one of the Salesforce APIs. Salesforce provides many type of apis (Enterprise API, Partner API, Rest API etc).

Using one of these API, you will insert a User record, that should create the user.

All of these APIs needs a session id, which you can get it from Partner API Login method.

Here is an example on how to create a record using Rest API.

0

In your code, you are Creating a LEAD instead of USER .

go thru the User object in the link and assign the fields in your UI to the fields of the user object and pass it to the CREATE method same way as u r doing for LEAD.

2
  • So instead of LEAD , just change everything to USER? and that will solve my issue?
    – Jonathan
    Commented Feb 24, 2015 at 22:43
  • and u need to assign it the proper fields of the USER object. FirstName, LastName, Email are same, so if u change LEAD to USER it should work Commented Feb 24, 2015 at 22:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .