• Swati Bhaip
  • 0 Points
  • Member since 2014

  • Chatter
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 6
  • 0

JSONObject leadField = new JSONObject();

leadField.put("Field Label", "Home");
  leadField.put("Field Name","Home");

PostMethod post = new PostMethod(instanceUrl
   + "/services/data/v20.0/sobjects/Lead/LeadCustomField");

I can write this sample code for creating Lead Custom Field using Rest Api but the passing url to PostMethod is not working Please Help me for creating a Lead custom Field using Rest Api.
I have witten the below code to create Lead Custom Field but it is not work means it will not found the resource .So Please help me to create Custom field
public void createField(String instanceUrl, String accessToken,PrintWriter writer)

final MetricRegistry metrics = new MetricRegistry();

// in your app setup, create a pool that's shared for the whole app
RestConnectionPool<Integer> pool = new RestConnectionPoolImpl<Integer>(metrics);

int accId=55;

String instanceUrl1 = instanceUrl.substring("https://".length());
pool.configureOrg(accId, instanceUrl1, accessToken);

RestConnection connection = pool.getRestConnection(accId);
SObject newLead = RestSObjectImpl.getNew("LeadCustomField");
newLead.setField("FieldLabel", "NewLabel");
newLead.setField("DataType", "Picklist");

SaveResult result = null;
try {
  result = connection.create(newLead);
} catch (IOException e) {
  // TODO Auto-generated catch block
writer.write("Created a lead Custom field with id " + result.getId());
How to create custom field on Lead using Rest API java program
How to create custom field in Lead using java Program
how to update record in Lead using java program??
hello How i can navigate to setup->develop
how to update record in Lead using java program??