Quantcast
Channel: SQL Server Master Data Services forum
Viewing all articles
Browse latest Browse all 1311

Insert Data into MDS Entity from User Input programatically (MDS API)

$
0
0

I am trying to create entity member with the "EntityMemberCreate" function but it only create a record with Member name and the attributes columns remain empty. Can anyone tell me how to insert data in entity along with member name. I am passing user's input to this function as parametes.  Here is the code I am using:

private static void CreateEntityMember(string modelName, string versionName, string entityName, string aNewMemberName, string aNewCode, MemberType memberType, string HierarchyName, string PersonName, string FatherName)
        {
            // Create the request object for entity creation.
            EntityMembersCreateRequest createRequest = new EntityMembersCreateRequest();
            createRequest.Members = new EntityMembers();
            createRequest.ReturnCreatedIdentifiers = true;
            // Set the modelId, versionId, and entityId.
            createRequest.Members.ModelId = new Identifier { Name = modelName };
            createRequest.Members.VersionId = new Identifier { Name = versionName };
            createRequest.Members.EntityId = new Identifier { Name = entityName };
            createRequest.Members.MemberType = memberType;
            createRequest.Members.Members = new System.Collections.ObjectModel.Collection<Member> { };
            Member aNewMember = new Member();
            aNewMember.MemberId = new MemberIdentifier() { Name = aNewMemberName, Code = aNewCode, MemberType = memberType };
            createRequest.Members.Members.Add(aNewMember);
            // Create a new entity member
            EntityMembersCreateResponse createResponse = clientProxy.EntityMembersCreate(createRequest);

            HandleOperationErrors(createResponse.OperationResult);

        }

It will create a member in database with NULL attributes i.e: PersonName, FatherName as they were not set in the Member setting option.

Can anybody tell me how to create members with these NULL attributes filled.



Viewing all articles
Browse latest Browse all 1311

Trending Articles