I am trying to create a resource requirement using a workflow when there is a Sitevisit(custom activity ) record created. But the worklow is failing with below error code.The fields I am updating in the Resource Requirement are From Date, to Date, Subject, Status with Active, SiteVisit field with SiteVisit, allocation Method: Distribute evenly
Error Code: Nullable object must have a value.
Below is the plugin trace log.
Plugin Trace:
[Microsoft.Xrm.Sdk.Workflow: Microsoft.Xrm.Sdk.Workflow.Activities.CreateEntity]
[CreateStep1: Create Resource Requirement]
[ScheduleCommon.Plugins: ScheduleCommon.Plugins.PreOperationResourceRequirementCreate]
[52ec2e9f-7a69-e611-810a-00155dbc5810: Resource Scheduling - Create of msdyn_resourcerequirement]
FpsPlugin: PluginLocal.Create, Depth: 1
FpsPlugin: PluginLocal.Create, Depth: 1
FpsPlugin: PluginContext Start
FpsPlugin: MessageName: Create
FpsPlugin: PrimaryEntityName: msdyn_resourcerequirement
FpsPlugin: PrimaryEntityId: be11a638-c35b-ea11-a813-000d3a86bcc1
FpsPlugin: SecondaryEntityName: none
FpsPlugin: Stage: 20
FpsPlugin: PreEntityImages.Count: 0
FpsPlugin: PostEntityImages.Count: 0
FpsPlugin: UserId: 9aed2b3e-51aa-49be-83dd-6f2be6ef06a3
FpsPlugin: InitiatingUserID: 9aed2b3e-51aa-49be-83dd-6f2be6ef06a3
FpsPlugin: IsolationMode: 1
FpsPlugin: Mode: 0
FpsPlugin: OrganizationName: org0c564798
FpsPlugin: OrganizationId: f7d94187-2ffc-4f06-a480-5906063b99ac
FpsPlugin: BusinessUnitId: 7aa31088-df40-ea11-a815-000d3a86b9d0
FpsPlugin: CorrelationId: d38cc5a2-a2dd-4b68-a7ed-68177633a6e1
FpsPlugin: RequestId: 00000000-0000-0000-0000-000000000000
FpsPlugin: OperationId: 00000000-0000-0000-0000-000000000000
FpsPlugin: IsInTransaction: True
FpsPlugin: Depth: 2
FpsPlugin: IsExecutingOffline: False
FpsPlugin: Parent PluginContext Start
FpsPlugin: PluginContext Start
FpsPlugin: MessageName: Create
FpsPlugin: PrimaryEntityName: msdyn_resourcerequirement
FpsPlugin: PrimaryEntityId: be11a638-c35b-ea11-a813-000d3a86bcc1
FpsPlugin: SecondaryEntityName: none
FpsPlugin: Stage: 30
FpsPlugin: PreEntityImages.Count: 0
FpsPlugin: PostEntityImages.Count: 0
FpsPlugin: UserId: 9aed2b3e-51aa-49be-83dd-6f2be6ef06a3
FpsPlugin: InitiatingUserID: 9aed2b3e-51aa-49be-83dd-6f2be6ef06a3
FpsPlugin: IsolationMode: 1
FpsPlugin: Mode: 0
FpsPlugin: OrganizationName: org0c564798
FpsPlugin: OrganizationId: f7d94187-2ffc-4f06-a480-5906063b99ac
FpsPlugin: BusinessUnitId: 7aa31088-df40-ea11-a815-000d3a86b9d0
FpsPlugin: CorrelationId: d38cc5a2-a2dd-4b68-a7ed-68177633a6e1
FpsPlugin: RequestId: 00000000-0000-0000-0000-000000000000
FpsPlugin: OperationId: 00000000-0000-0000-0000-000000000000
FpsPlugin: IsInTransaction: True
FpsPlugin: Depth: 2
FpsPlugin: IsExecutingOffline: False
FpsPlugin: PluginContext End
FpsPlugin: Parent PluginContext End
FpsPlugin: PluginContext End
FpsPlugin: PluginLocal.Create, Depth: 1
FpsPlugin: InitializePlugin: local
FpsPlugin: ConfigurePluginFlagsSupportInternal()
FpsPlugin: CreateEntityOperation(msdyn_resourcerequirement)
FpsPlugin: Operation type: ResourceRequirementOperation
FpsPlugin: operation.Initialize()
FpsPlugin: operation.Execute()
FpsPlugin: PluginStage: 20 MessageName: Create
FpsPlugin: Before calling message handler
FpsPlugin: Before
FpsPlugin: BeforeCreate
FpsPlugin: BeforeCreateOrUpdate
FpsPlugin: BookingSetupMetadata: Cache miss for 6 BookingSetupMetadataDB records
FpsPlugin: CrmMetadataCache [45101472|289]: ctor()
FpsPlugin: CrmMetadataCache [45101472|289]: REQUEST Timestamp: , Metadata: new_sitevisit: . bookableresourcebooking: new_new_sitevisit, msdyn_projectid, msdyn_appointmentbookingid, msdyn_workorder, msdyn_serviceappointment. msdyn_resourcerequirement: new_new_sitevisit, msdyn_projectid, msdyn_appointmentrequirementid, msdyn_workorder, msdyn_serviceappointment. bookingstatus: msdyn_committype, msdyn_fieldservicestatus, msdyn_serviceappointmentstatus. msdyn_project: . appointment: . msdyn_workorder: . serviceappointment:
FpsPlugin: CrmMetadataCache [45101472|289]: RESPONSE Timestamp: 3586831!03/01/2020 13:47:48, Metadata: msdyn_resourcerequirement: attribs: 5, relationships:0. msdyn_project: attribs: 0, relationships:0. appointment: attribs: 0, relationships:0. serviceappointment: attribs: 0, relationships:0. msdyn_workorder: attribs: 0, relationships:0. bookingstatus: attribs: 3, relationships:0. bookableresourcebooking: attribs: 5, relationships:0. new_sitevisit: attribs: 0, relationships:0
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: REQUEST Timestamp: , Metadata: new_sitevisit: subject
FpsPlugin: CrmMetadataCache [45101472|289]: RESPONSE Timestamp: 3586831!03/01/2020 13:47:48, Metadata: new_sitevisit: attribs: 1, relationships:0
FpsPlugin: CrmMetadataCache [45101472|289]: GET Missed: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: REQUEST Timestamp: , Metadata: msdyn_project: msdyn_subject
FpsPlugin: CrmMetadataCache [45101472|289]: RESPONSE Timestamp: 3586831!03/01/2020 13:47:48, Metadata: msdyn_project: attribs: 1, relationships:0
FpsPlugin: CrmMetadataCache [45101472|289]: GET Missed: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: REQUEST Timestamp: , Metadata: appointment: subject
FpsPlugin: CrmMetadataCache [45101472|289]: RESPONSE Timestamp: 3586831!03/01/2020 13:47:48, Metadata: appointment: attribs: 1, relationships:0
FpsPlugin: CrmMetadataCache [45101472|289]: GET Missed: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: REQUEST Timestamp: , Metadata: msdyn_workorder: msdyn_name
FpsPlugin: CrmMetadataCache [45101472|289]: RESPONSE Timestamp: 3586831!03/01/2020 13:47:48, Metadata: msdyn_workorder: attribs: 1, relationships:0
FpsPlugin: CrmMetadataCache [45101472|289]: GET Missed: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: REQUEST Timestamp: , Metadata: serviceappointment: subject
FpsPlugin: CrmMetadataCache [45101472|289]: RESPONSE Timestamp: 3586831!03/01/2020 13:47:48, Metadata: serviceappointment: attribs: 1, relationships:0
FpsPlugin: CrmMetadataCache [45101472|289]: GET Missed: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: CrmMetadataCache [45101472|289]: GET: Result True
FpsPlugin: After calling message handler
FpsPlugin: PluginLocal.Dispose, Depth: 1
FpsPlugin: PluginLocal.Dispose, Depth: 1
FpsPlugin: PluginLocal.Dispose, Depth: 1
Entered ScheduleCommon.Plugins.PreOperationResourceRequirementCreate.Execute(), Correlation Id: d38cc5a2-a2dd-4b68-a7ed-68177633a6e1, Initiating User: 9aed2b3e-51aa-49be-83dd-6f2be6ef06a3
Exception: System.InvalidOperationException: Nullable object must have a value.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at Microsoft.Dynamics.ScheduleCommon.ResourceSchedule.ResourceRequirement.ResourceRequirementDetailGenerator.GetCalendarCapacityTimeSlices(IOrganizationService organizationService, ResourceRequirement requirementHeader)
at Microsoft.Dynamics.ScheduleCommon.ResourceSchedule.ResourceRequirement.ResourceRequirementDetailGenerator.GetTimeSlicesToAllocateForRequirementDetails(IOrganizationService organizationService, ResourceRequirement requirementHeader)
at Microsoft.Dynamics.ScheduleCommon.ResourceSchedule.ResourceRequirement.ResourceRequirementDetailGenerator.InitializeResourceRequirementDetailsFromHeader(IOrganizationService organizationService, ResourceRequirement requirementHeader, Int32& duration)
at ScheduleCommon.Plugins.PreOperationResourceRequirementCreate.ExecuteCrmPlugin(LocalPluginContext localContext)
at ScheduleCommon.Plugins.PluginBase.Execute(IServiceProvider serviceProvider), Correlation Id: d38cc5a2-a2dd-4b68-a7ed-68177633a6e1, Initiating User: 9aed2b3e-51aa-49be-83dd-6f2be6ef06a3
Exiting ScheduleCommon.Plugins.PreOperationResourceRequirementCreate.Execute(), Correlation Id: d38cc5a2-a2dd-4b68-a7ed-68177633a6e1, Initiating User: 9aed2b3e-51aa-49be-83dd-6f2be6ef06a3
Error Message:
Unhandled exception:
Exception type: Microsoft.Xrm.Sdk.InvalidPluginExecutionException
Message: Nullable object must have a value.
-- End stack trace --

Report
All responses (
Answers (