+ Start a Discussion
Jordan@BracketLabsJordan@BracketLabs 

VFRemote.js throws error when creating Chatter Content Post

I'm using VF Remoting to create a Chatter Content Post.

 

When I run a similar operation to create a Chatter Text Post, the operation runs just fine.

 

No exception is being returned, and the error seems to be in JS (Firebug Output):

 

e is undefined
[Break On This Error] this);e.on("exception",this.onProvider...n(e){return this.transactions[e.tid||  

The operation is successfully completed in Apex and everything operates normally, and the response from the server is accurate and complete. However, due to this error, my callback function no longer operates, so I can't continue as normal.

 

Updated: I've logged this with the Partner Support portal. Here is some more source code to give you an idea:

 

global with sharing class Controller{	
@RemoteAction global static public chatterFeedPost PostChatterContent(String taskId, String commentText, String fileBody, String fileName){ chatterFeedPost returnPost = new chatterFeedPost(); FeedPost post = new FeedPost(); post.ParentId = taskId; post.Body = commentText; if(fileName != '' && fileBody != ''){ post.ContentData = EncodingUtil.base64decode(fileBody); post.ContentFileName = fileName; } returnPost.user = [SELECT Id,SmallPhotoUrl,Name FROM User WHERE Id = :UserInfo.getUserId()]; returnPost.feedpost = post; insert post; return returnPost; } global class chatterFeedPost { public FeedPost feedpost {get;set;} public User user {get;set;} public String errorMessage {get;set;} }
}

 And the Javascript:

 

<apex:Page controller="Controller">
<script type="text/javascript>
var result = Controller.PostChatterContent('string:chatter-object-target_id', 'string:chatterposttext', 'string:base64encodedcontent', 'string:filename',function(event, result){
					if (result.status) { //... do something ... }
</script>					
</page>

 


Suresh_SoftsquareSuresh_Softsquare

Jordan,

 

Did you get any response from the Partner Support? We are stuck with this same issue. We get this problem when the number of records returned by the controller exceeds more than 200. Since, the callback method itself is not called, we have no idea on what happens in the background. Looking forward your reply.

 

Thanks,

Suresh.

Jordan@BracketLabsJordan@BracketLabs

Hey Suresh_Softsquare -

 

It was reported to me that this was a bug in the Visualforce engine attempting to serialize the viewstate and that it might be fixed in Winter '12...?

 

Moving data between the page and the controller via Javascript in base64encoded format without the HTML5 Data API, thus, I don't think this is a viable solution anymore until HTML5 is in complete adoption.

 

Furthermore, there was a bug in the ContentVersion + VisualForce viewstate, I believe this was fixed in Winter '12.

 

So depending on how your using the filesystem in Salesforce, I would focus on creating a ContentVersion record and tahn associating it with the 'chatter post'. If you have more questions please let me know, I'm more than happy to share my learning.

 

Jordan

Suresh_SoftsquareSuresh_Softsquare

Jordan,

 

Thanks for your response. Actually we are not doing anything related to ContentVersion. We are doing a Google map integration. For this, we do a query on a Remote Action annotated method which would retrun a list of records. The records in the list don't have any base64 encoded data in them. If we keep the number of records to 200, everything works. When we increase more tha  that we get into this issue.

 

The problem is we don't see any exception in the Apex log and the  javascript callback too fails. So, we couldn't find whats happening behind the screen. When looking at the Mozilla's Error Console, we see the error message 'e is null' which points to vfremote.js. What do you think of our case? Could this be a salesforce bug or is there any workaround that we may need to do to get rid of this? Any help would be greatly appreciated.

 

Thanks,

Suresh

Jordan@BracketLabsJordan@BracketLabs

@Suresh_Softsquare

 

I would recommend you reach out to Salesforce on this one (partner support?)

 

VF Remoting seems to work well for simplistic calls, but for example, I haven't been able to pass in an array of arguments (the way you would with an Apex SOAP Web-service, or Apex REST Web-service).

 

I haven't expirementing with returning large numbers of results, but if your having trouble with 200+ items on return, maybe you should try an Apex REST Webservice or Apex SOAP Webservice?

 

Jordan

fxia@crunchtimefxia@crunchtime

We have recently encountered a similiar problem with IE6 & 8 that "tid" is null or not an object. 

 

We have a VF page with javascript calling a @RemoteAction in the controller extension. It turned out (after 10+ hours) String.valueOf() will not turn value null into a string "null"!!!! To fix this situation, see the code snippet below:

 

gpResults = Database.query(queryString);
for (AggregateResult ar : gpResults){
String tmpKey = String.valueOf(ar.get(filterField));

// This line is the live saver that was causing IE to crash!
if (tmpKey == null) tmpKey='null';
myMap.put(tmpKey, Integer.valueOf(ar.get('cnt')));
}

 

Hope this can helpful to someone.

 

How can I report this to SalesForce to get it fixed?

 

Feng