-
ChatterFeed
-
0Best Answers
-
1Likes Received
-
0Likes Given
-
6Questions
-
0Replies
CustomField
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.
-
- Swati Bhaip
- July 03, 2014
- Like
- 0
- Continue reading or reply
Custom field
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
e.printStackTrace();
}
writer.write("Created a lead Custom field with id " + result.getId());
}
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
e.printStackTrace();
}
writer.write("Created a lead Custom field with id " + result.getId());
}
-
- Swati Bhaip
- July 01, 2014
- Like
- 0
- Continue reading or reply
-
- Swati Bhaip
- July 01, 2014
- Like
- 0
- Continue reading or reply
-
- Swati Bhaip
- June 25, 2014
- Like
- 0
- Continue reading or reply
-
- Swati Bhaip
- June 24, 2014
- Like
- 1
- Continue reading or reply
-
- Swati Bhaip
- June 19, 2014
- Like
- 0
- Continue reading or reply
-
- Swati Bhaip
- June 24, 2014
- Like
- 1
- Continue reading or reply