Wednesday, November 28, 2012

MDS - Operation is not valid due to the current state of the objec


If you have a large model and you are trying edit security settings in MDS(Master Data Services) you may get the following error:

An unknown error occurred.

or
Operation is not valid due to the current state of the object

or
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Operation is not valid due to the current state of the object.

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 
[InvalidOperationException: Operation is not valid due to the current state of the object.]
   System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) +11371791
   System.Web.HttpRequest.FillInFormCollection() +329

[HttpException (0x80004005): The URL-encoded form data is not valid.]
   System.Web.HttpRequest.FillInFormCollection() +11485906
   System.Web.HttpRequest.get_Form() +157
   System.Web.HttpRequest.get_HasForm() +11486708
   System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +141
   System.Web.UI.Page.DeterminePostBackMode() +100
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +259

Solution
Thanks to the MS MDS support team you need to add the following to the web.config file located C:\Program Files\Microsoft SQL Server\110\Master Data Services\WebApplication

<configuration>
<appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="2000" />
</appSettings>
</configuration>

appSettings is located near the end of the file. If the error is still occurring increase the value 10000

Wednesday, November 14, 2012

MDS Missing attribute


Tag
Master Data Services

I had an issue where the subscription view would show all the attributes but when trying to edit the entity in Explorer or System Administration the attribute would not appear.
So started looking at mdm.tblAttribute table and there it was. So then I looked in mdm.viw_SYSTEM_SCHEMA_ATTRIBUTES and it was missing


SELECT
*
FROM
mdm.tblModel tMod  
JOIN mdm.tblEntity tEnt ON tMod.ID = tEnt.Model_ID  
JOIN mdm.tblAttribute tAtt ON tEnt.ID = tAtt.Entity_ID  
JOIN  mdm.tblEntityMemberType tMemberType ON tAtt.MemberType_ID = tMemberType.ID
JOIN mdm.tblList tAttributeType ON tAttributeType.ListCode = N'lstAttributeType' AND tAtt.AttributeType_ID = tAttributeType.OptionID
JOIN mdm.tblList tDataType ON tDataType.ListCode = N'lstDataType' AND tAtt.DataType_ID = tDataType.OptionID
--JOIN mdm.tblUser usrE ON tAtt.EnterUserID = usrE.ID
--JOIN mdm.tblUser usrL ON tAtt.LastChgUserID = usrL.ID
LEFT OUTER JOIN mdm.tblList tDataMask ON tDataMask.ListCode = N'lstInputMask' AND tAtt.InputMask_ID = tDataMask.OptionID AND tAtt.DataType_ID = tDataMask.Group_ID
LEFT OUTER JOIN mdm.tblEntity tDBAEnt ON tAtt.DomainEntity_ID = tDBAEnt.ID

It turns out I had DELETED all the users from the mdm.tblUser table except for user ID 1. Problem is viw_SYSTEM_SCHEMA_ATTRIBUTES does an INNER JOIN with the tblUser table.

Run the following to check if there are any issues.


SELECT * FROM mdm.tblEntity WHERE
EnterUserID <> 1
OR LastChgUserID <> 1

SELECT * FROM mdm.tblAttribute WHERE
EnterUserID <> 1
OR LastChgUserID <> 1

UPDATE mdm.tblAttribute SET EnterUserID = 1, LastChgUserID = 1 WHERE EnterUserID <> 1 OR LastChgUserID <> 1