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
MikhailVMikhailV 

NinjaValidationException while inserting CollaborationGroup

Hi,

I have a strange issue with creating chatter group with my Apex code.

Simple code for creating CollaborationGroup works fine in development environment, but raises NinjaValidationException when installing uploaded package.

I didn't find any documentation about this exception and neither any information about what is wrong with the code.

 

Code:
CollaborationGroup grpRec = new CollaborationGroup();

grpRec.Name = 'New';

grpRec.CollaborationType = 'Public';

insert grpRec;

 

This code fails in insert statement
Exception log:

Insert failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, com.ninja.common.exception.NinjaValidationException: workspaceId - This field is required: []

 

As you can see, it says that some field is required, but instead of required field names there is an empty list.

 

Can anybody advice what is wrong here, or is there any workaround for the issue?

Christ.atcChrist.atc

 

Insert failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, com.ninja.common.exception.NinjaValidationException: workspaceId - This field is required: []

 

Hi, at first glance it seems that  you have to assign a workspaceId when you are creating a new CollaborationGroup.

 

try createing a workspace then put the id int code before inserting.

 

Code:
CollaborationGroup grpRec = new CollaborationGroup();

grpRec.workspaceId ='your newly created worspace id' ;

grpRec.Name = 'New';

grpRec.CollaborationType = 'Public';

insert grpRec;

 



MikhailVMikhailV

As per http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_collaborationgroup.htm CollaborationGroup object doesn't have property  workspaceId. I don't see a way to create workspace and add its ID to CollaborationGroup .

DenVDenV

Hi,

 

I am curious if you found a solution to this issue.

 

I am seeing the same error when trying to create a CollaborationGroup. In my case it occurs when the group is being created from within a packaged class. 

 

Thanks.

Andrea mAndrea m

hi, I run into the same problem when my test methods are executed before installing a managed release package with namespace.

did you found any solutions on this?

vmikhailvmikhail

Unfortunately no, sorry

Alibaba1Alibaba1

Seen similar issue.  Related to content not been enabled in the org where issue occurs.