You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In a Create Post-Operation plugin on an entity with calling user as the owner, Target Entity does not have an 'owningbusinessunit' attribute defined in Mockup Tests. However, in D365 this attribute is present in Target Entity in Post-Operation stage.
Assuming same issue with a team as owner regarding 'owningteam' attribute.
No workaround possible, even setting the raw attribute becomes null in Mockup Test.
To Reproduce
[TestMethod]
public void GivenUserInBusinessUnit_WhenCreatingAccount_ExpectOwnerToBeBusinessUnit()
{
// Arrange
var userDenmark = new SystemUser
{
FirstName = "Luke",
LastName = "Skywalker",
InternalEMailAddress = "[email protected]",
BusinessUnitId = _businessUnitDenmark.ToEntityReference()
};
userDenmark = Crm.CreateUser(OrgAdminService, userDenmark, SecurityRoles.Salesperson) as SystemUser;
OrgService = Crm.CreateOrganizationService(userDenmark.Id);
// Act
var account = new Account
{
Name = "Test Account"
};
account.Id = OrgService.Create(account);
// Assert
var accountFromD365 = Account.Retrieve(OrgAdminService, account.Id);
accountFromD365.OwnerId.Id.Should().Be(_businessUnitDenmark.Id);
}
A plugin is in place that contains this fragment:
using (var context = new Xrm(localContext.OrganizationAdminService))
{
var owningBusinessUnitTeam = context.TeamSet.FirstOrDefault(x => x.BusinessUnitId.Id == targetEntity.OwningBusinessUnit.Id);
if (owningBusinessUnitTeam != null)
localContext.OrganizationAdminService.Update(new Account(targetEntity.Id) { OwnerId = owningBusinessUnitTeam.ToEntityReference() });
The usage of OwningBusinessUnit.Id throws an exception in Mockup, but not in D365.
Expected behavior
OwningBusinessUnit should be populated in Create Post-Operation as it is in D365.
Environment
CRM/D365/CDS version: 9.1.x
Tool version: 1.1.0
The text was updated successfully, but these errors were encountered:
This looks to be related to #101 where other system field values are not set in the post operation plugin - it should be possible to add OwningBusinessUnit into the list of system attributes so that it is included.
Describe the bug
In a Create Post-Operation plugin on an entity with calling user as the owner, Target Entity does not have an 'owningbusinessunit' attribute defined in Mockup Tests. However, in D365 this attribute is present in Target Entity in Post-Operation stage.
Assuming same issue with a team as owner regarding 'owningteam' attribute.
No workaround possible, even setting the raw attribute becomes null in Mockup Test.
To Reproduce
A plugin is in place that contains this fragment:
The usage of OwningBusinessUnit.Id throws an exception in Mockup, but not in D365.
Expected behavior
OwningBusinessUnit should be populated in Create Post-Operation as it is in D365.
Environment
The text was updated successfully, but these errors were encountered: