web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

ActivitiesFeedsBundle javascript error

(0) ShareShare
ReportReport
Posted on by

Hi all,

When I open any opportunity form I get the following js error: Cannot read property 'getCurrentItem' of null.
Investigating the problem and reading call stack I've got some details:

Stack trace:

renderOlderPosts (JsProvider.ashx?bundle=ActivitiesFeedsBundle&ids=1469705066-1731109441-213957365-330369912-20406073…:1252)
processRetrievePostsResponse (JsProvider.ashx?bundle=FormControlExtendedBundle&ids=202888856-493509602:formatted:556)
loadPosts (JsProvider.ashx?bundle=ActivitiesFeedsBundle&ids=1469705066-1731109441-213957365-330369912-20406073…:1318)
(anonymous) (MicrosoftAjax.js?ver=987093208:24)
(anonymous) (JsProvider.ashx?bundle=FormControlExtendedBundle&ids=202888856-493509602:formatted:1161)
readyStateChanged (JsProvider.ashx?bundle=CoreBundle&ids=1401263868-1250882489-468302605-1405388298-1194605645-3425196…:663)


Function where error is caused (renderOlderPosts):

renderOlderPosts: function() {
	var $v_0 = this.wallContainerjQuery.find(".showMoreLink");
	$v_0.addClass("showMoreLinkProgress");
	this.$3_0 = 3;
	var $v_1 = this.$0_0.getWallServiceFactory().createRetrievePostsRequest();
	$v_1.set_pageSize(this.$8_0);
	$v_1.set_endDate(this.$H_0);
	$v_1.set_pagingCookie(this.$A_0);
	this.$5_0++;
	$v_1.set_pageNumber(this.$5_0);
	var $v_2 = {
		page: this.$5_0,
		wallType: this.rootContainer[0].id,
		entity: !Xrm.Page.data ? null : Xrm.Page.data.entity.getEntityName(),
		form: !Xrm.Page.ui ? null : Xrm.Page.ui.formSelector.getCurrentItem().getId()
	};
	this.fireEvent(Wall.Interfaces.EventArguments.PostsRefreshingEventArgs, "PostsRefreshing", new Wall.Interfaces.EventArguments.PostsRefreshingEventArgs($v_1));
	var $$t_5 = this;
	this.$0_0.retrievePosts($v_1, function($p1_0) {
		$$t_5.processRetrievePostsResponse($p1_0, function() {
			$v_0.removeClass("showMoreLinkProgress").remove();
			$$t_5.$3_0 = 1;
			var $v_3 = Wall.Control.Utils.WallUtils.removeDuplicatePosts($p1_0.get_posts(), $$t_5.$1_0);
			$$t_5.$n_0($v_3);
			$p1_0.get_morePosts() && $$t_5.$o_0();
			$v_2["posts"] = $v_3.length;
			Mscrm.MetricsReporting.instance().addMetric("Wall.LoadMore", $v_2)
		}, function() {
			$v_0.removeClass("showMoreLinkProgress");
			$v_2["posts"] = 0;
			Mscrm.MetricsReporting.instance().addMetric("Wall.LoadMore", $v_2)
		}, function() {
			$v_0.removeClass("showMoreLinkProgress");
			$$t_5.$3_0 = 5;
			$v_2["error"] = true;
			Mscrm.MetricsReporting.instance().addMetric("Wall.LoadMore", $v_2);
			alert($p1_0.get_errorMessage())
		})
	})
}

As we can see from the call stack, this function is a part of ActivityFeedsBundle. (In my installation ActivityFeeds I turned off activity feeds for all entities.)

Error is caused on 15th line where execution context trying to get Id of CurrentItem, where formSelector is null so it is a null reference exception.


Also, as stated here https://community.dynamics.com/crm/b/sohodynamicscrmworld/archive/2013/10/02/microsoft-dynamics-crm-2013-xrm-page-ui-formselector Xrm.Page.ui.formSelector.getCurrentItem() can return null if there's only one form for this entity, so if this happens 

Xrm.Page.ui.formSelector.getCurrentItem().getId()


we won't be able to getId() of null.

I think that this is business logic error and needs to be corrected.

Also is there any way to fix this issue without editing ActivitiesFeedsBundle js file.

Thank you in advance.

P.S.: Running full-text search on CRMWeb folder I found this script location:
C:\Program Files\Microsoft Dynamics CRM\CRMWeb\_static\_common\scripts\Wall.Control.js

*This post is locked for comments

I have the same question (0)
  • Roman Matveev Profile Picture
    on at

    As I don't use Activity feeds at all, to workaround this issue I've just replaced renderOlderPosts() function body with return and error dissapeared.

    So how it looks now:

    renderOlderPosts: function() {
    	return;
    }

    But want to hear from Dynamics specialists about this issue.

  • CList Profile Picture
    on at

    We ran into the exact same problem on a couple of our custom entity forms.

    Thanks so much for this - I did the same thing and put a return at the start of the function (though you could also check to see if Xrm.Page.ui.formSelector is not null). 

    This needs to be fixed by Microsoft...

    I feel bad for the folks who don't have on-premise. 

  • Roman Matveev Profile Picture
    on at

    @CList, be extremely carefull when doing anything to this function. Some time after disabling the function we noticed that lazy loading of comments block (if opportunity have many comments, first loaded only part of them, then other loading continiously) is not working. After a week of puzzling over and debugging we found that this function was responsible for rendering the comments on old forms (v1.0) and turning it off wasn't the best solution.

    You can read our struggling here: stackoverflow.com/.../crm-show-all-notes-on-the-form-instead-of-lazy-loading ;)

    To check if Xrm.Page.ui.formSelector is not null is a definetly better solution.

  • Verified answer
    CList Profile Picture
    on at

    Mmmm, yeah, we started getting some weird errors in totally unrelated bits of the core javascript, so I got rid of the return, and then changed it from this:

    var $v_2={
      page:this.$5_0
      ,wallType:this.rootContainer[0].id
      ,entity:!Xrm.Page.data?null:Xrm.Page.data.entity.getEntityName()
      ,form:!Xrm.Page.ui ? null:Xrm.Page.ui.formSelector.getCurrentItem().getId()
    };

    to this:

    var $v_2={
      page:this.$5_0
      ,wallType:this.rootContainer[0].id
      ,entity:!Xrm.Page.data?null:Xrm.Page.data.entity.getEntityName()
      ,form:!Xrm.Page.ui || !Xrm.Page.ui.formSelector || !Xrm.Page.ui.formSelector.getCurrentItem() ? null:Xrm.Page.ui.formSelector.getCurrentItem().getId()
    };
    

    ...and everything seems to be working well...

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans