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
Java_Chatter_IntegrationJava_Chatter_Integration 

How to post a feed using java in chatter to specific object e.g Account,Contact

Hi Folks,

 

I need to post a feed to chatter's account , contact etc using java.

Below is my code:-

 

SObject user = new SObject();
user.setType("user");
 user.setId(connection.getUserInfo().getUserId());
 user.setField("currentStatus", in.readLine());
 SaveResult[] results = connection.update(new SObject[] { user });

 

Above code works , if we need to post a feed to chatter.

 

I am trying to modify the code:-

SObject user = new SObject();
user.setType("Account"); // This the type called Account , because i need to post my feed to account object.
user.setId("0019000000BJlvz");  // This is the parent ID of my account.
user.setField("currentStatus", in.readLine()); // This is invalid field , because we don't have any field called currentStatus in account object.
SaveResult[] results = connection.update(new SObject[] { user });

 

So if i run the above code , i gets No Column exits for Account entity exception.

 

Is there a way to post our feeds directly to account object using java.

 

Your help is really appreaciated.

 

Thanks,

Harsha.

 

Aniruddha.ManakeshwarAniruddha.Manakeshwar

Hi,

 

I am also creating a poc for this. Can you please post the code here ?  I have also written the code but i am facing proxy issues. Even though i have added proxy before connecting to Salesforce i am facing connections issue.   Do you have any work around for this? 

 

SObject user = new SObject();
user.setType("user");
 user.setId(connection.getUserInfo().getUserId());
 user.setField("currentStatus", in.readLine());
 SaveResult[] results = connection.update(new SObject[] { user });

 

What is connection type in above code and what is in type?

 

Appreciate for your help.

 

Thanks,
Aniruddha