Dear All,
i have a business requirement to create a custom confirm box on reactivate case button in case entity. in our case when we reactivate the case the sla records will also reinstate and sla timers will start running for this we have a workflow to start sla timers. but our customers want one option like when user clicked on reactivate case button he should get one confirm dialog box with two options amend and reactivate. when he clicked on amend button he should able to reactivate the case not sla records and sla timers should not start. when he clicked on reactivate button he should be able reactivate the case and sla records should reinstate then sla timers should start.
please help me on this.
i am trying with the below script but no luck:
function showConfirmDialog() {
debugger;
Xrm.Utility.confirmDialog("Do you want to reinstate SLA records ",
function() {
Mscrm.CommandBarActions.reactivate();
var date=new Date();
Xrm.Page.getAttribute("new_SLASTARTDATE").setValue(date);
},
function() {
Mscrm.CommandBarActions.reactivate();
});
}
Regards
Mahesh
*This post is locked for comments
basically you are trying to update values while the record is still deactivated. You'll need to reactivate the record programmatically before you can update it.
Hi Pravin,
Thanks for your solution please find the reply of my error above
Hi T.I.A,
Thanks for your solution. as per my requirement on click of reactivate button in the case i should get a confirm dailog box with two options. i had achieved this but problem is that confirm dialog box when i click on reactivate the sla records should reinstate and sla timers should start, for this i am setting a date field in j script and if click on amend it should do ntg. only records should be active not sla.
Below is the code and the error i am getting while clicking on the reactivate.
function dialogbox()
{
debugger;
CrmService.IncidentRibbon.CommandBarActions.reactivate();
setTimeout(function () {
var confirmStrings = { text:"Do you want to Reactivate or Amend.", title:"Confirmation Dialog", "cancelButtonLabel": "Amend", confirmButtonLabel: "Reactivate" };
var confirmOptions = { height: 200, width: 500};
setTimeout(function () {
Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
function (success)
{
debugger;
if (success.confirmed)
{
var date=new Date();
Xrm.Page.getAttribute("new_deadline").setValue(date);
Xrm.Page.getAttribute("new_deadline").setSubmitMode("always");
Xrm.Page.data.save();
}
else
{
Xrm.Page.getAttribute("description").setValue("No");
}
}, 1000);});
Xrm.Page.data.save();
}, 1000);
Xrm.Page.data.save();
}
ERROR:
Error:Unhandled exception:
Exception type: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]
Message: Since case is resolved and read-only, only these attributes are updatable : "ownerid", "owneridyominame", "owneridtype", "owninguser", "statecode", "statuscode", "modifiedon", "modifiedby", "modifiedonbehalfby", "owningbusinessunit" , "processid". If you need to edit other fields, please reactivate the case.Detail:
<OrganizationServiceFault xmlns:i="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../Contracts">
<ActivityId>c4ec6e6f-6d25-4672-92da-012901d84d86</ActivityId>
<ErrorCode>-2147020529</ErrorCode>
<ErrorDetails xmlns:d2p1="schemas.datacontract.org/.../System.Collections.Generic">
<KeyValuePairOfstringanyType>
<d2p1:key>CallStack</d2p1:key>
<d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:string"> at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at Microsoft.Dynamics.Solution.Common.CrmException.BuildOrganizationServiceFault(Exception innerException, Int32 errorCode, String message)
at Microsoft.Dynamics.Solution.Common.CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException, Boolean enableTrace)
at Microsoft.Dynamics.Solution.Common.CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException)
at Microsoft.Dynamics.Solution.Common.CrmException..ctor(String message, Int32 errorCode)
at Microsoft.Crm.Service.ObjectModel.IncidentService.PreValidateForUpdate(Case incident, ISecurityService securityService)
at Microsoft.Dynamics.Service.Plugins.PreOperationIncidentUpdate.ExecuteCrmPlugin(LocalPluginContext localContext)
at Microsoft.Dynamics.Solution.Common.PluginBase.Execute(IServiceProvider serviceProvider)
at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.Pipeline.<>c__DisplayClass2_1.<Execute>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action, IEnumerable`1 additionalCustomProperties)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.Crm.Extensibility.Pipeline.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.MessageProcessor.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.InternalMessageDispatcher.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.ExtensiblePlatformMessageDispatcher.Execute(PipelineExecutionContext pluginContext)
at Microsoft.Crm.Extensibility.ExtensiblePlatformMessageDispatcher.UpdateWithInvocationSource(BusinessEntity entity, FilterExpression filter, Int32 invocationSource, ExecutionContext context)
at Microsoft.Crm.Extensibility.ExtensiblePlatformMessageDispatcher.Update(BusinessEntity entity, FilterExpression filter, ExecutionContext context)
at Microsoft.Crm.BusinessEntities.BusinessProcessObject.<>c__DisplayClass199_0.<UpdateWithPipelineAndExtensions>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action, IEnumerable`1 additionalCustomProperties)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action, IEnumerable`1 additionalCustomProperties)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IServiceProvider serviceProvider)
at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.Pipeline.<>c__DisplayClass2_1.<Execute>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action, IEnumerable`1 additionalCustomProperties)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.Crm.Extensibility.Pipeline.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.MessageProcessor.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.InternalMessageDispatcher.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, Guid callerRegardingObjectId, Int32 invocationSource, Version endpointVersion, OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.DispatchRequest(OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest, SdkResponseDescription responseDescription, SdkPerformanceCounterContext sdkPerformanceCounterContext)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequestRequestWithInstrumentation(OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequestRequestWithInstrumentationOperation(OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.<>c__DisplayClass17_0.<ExecuteRequest>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, InvocationContext invocationContext, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Guid targetCallerRegardingObjectId, UserType targetUserType, OrganizationContext context, Boolean returnResponse, Boolean checkAdminMode, Dictionary`2 optionalParameters)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequestInternal(OrganizationRequest request, InvocationContext invocationContext, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext, Dictionary`2 optionalParameters)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, InvocationContext invocationContext, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext, Dictionary`2 optionalParameters)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Execute(OrganizationRequest request, InvocationContext invocationContext, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext, Dictionary`2 optionalParameters)
at Microsoft.Crm.Extensibility.InprocessServiceProxy.ExecuteCore(OrganizationRequest request)
at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
at Microsoft.Crm.Application.Platform.ServiceCommands.UpdateCommand.Execute()
at Microsoft.Crm.Application.Platform.EntityProxy.Update(Boolean performDuplicateCheck, Guid auditingTransactionId)
at Microsoft.Crm.Application.Platform.EntityProxy.Update(Boolean performDuplicateCheck)
at Microsoft.Crm.Application.Platform.EntityProxy.UpdateAndRetrieve(String[] columnSet, Boolean performDuplicateCheck)
at Microsoft.Crm.Core.Application.WebServices.InlineEdit.CommandBase.UpdateEntity(Entity entity, Boolean retrieve)
at Microsoft.Crm.Core.Application.WebServices.InlineEdit.SaveCommand.ExecuteCommand(String commandXml)
at Microsoft.Crm.Core.Application.WebServices.InlineEdit.CommandBase.Execute(String commandXml, Boolean encodeValues)
at Microsoft.Crm.Core.Application.WebServices.InlineEditWebService.Execute(Int32 command, String commandXml, Nullable`1 encodeValues)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
at System.Web.Services.Protocols.WebServiceHandler.Invoke()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
at System.Web.Services.Protocols.SyncSessionlessHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)
at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)</d2p1:value>
</KeyValuePairOfstringanyType>
</ErrorDetails>
<Message>Since case is resolved and read-only, only these attributes are updatable : "ownerid", "owneridyominame", "owneridtype", "owninguser", "statecode", "statuscode", "modifiedon", "modifiedby", "modifiedonbehalfby", "owningbusinessunit" , "processid". If you need to edit other fields, please reactivate the case.</Message>
<Timestamp>2019-06-22T13:36:25.8360882Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText>
[Microsoft.Dynamics.Service.Plugins: Microsoft.Dynamics.Service.Plugins.PreOperationIncidentUpdate]
[b986a294-28b3-e611-80f0-00155dc13602: PreOperation of Incident Update]
Entered Microsoft.Dynamics.Service.Plugins.PreOperationIncidentUpdate.Execute(), Correlation Id: 7fcf1f18-636c-4b0c-bd3a-31d05e70a45c, Initiating User: 203d2816-3430-4766-80a1-933592357c96
Exception: Microsoft.Dynamics.Solution.Common.CrmException: Since case is resolved and read-only, only these attributes are updatable : "ownerid", "owneridyominame", "owneridtype", "owninguser", "statecode", "statuscode", "modifiedon", "modifiedby", "modifiedonbehalfby", "owningbusinessunit" , "processid". If you need to edit other fields, please reactivate the case. (Fault Detail is equal to Exception details:
ErrorCode: 0x8007110F
Message: Since case is resolved and read-only, only these attributes are updatable : "ownerid", "owneridyominame", "owneridtype", "owninguser", "statecode", "statuscode", "modifiedon", "modifiedby", "modifiedonbehalfby", "owningbusinessunit" , "processid". If you need to edit other fields, please reactivate the case.
StackTrace:
at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at Microsoft.Dynamics.Solution.Common.CrmException.BuildOrganizationServiceFault(Exception innerException, Int32 errorCode, String message)
at Microsoft.Dynamics.Solution.Common.CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException, Boolean enableTrace)
at Microsoft.Dynamics.Solution.Common.CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException)
at Microsoft.Dynamics.Solution.Common.CrmException..c...)., Correlation Id: 7fcf1f18-636c-4b0c-bd3a-31d05e70a45c, Initiating User: 203d2816-3430-4766-80a1-933592357c96
Exiting Microsoft.Dynamics.Service.Plugins.PreOperationIncidentUpdate.Execute(), Correlation Id: 7fcf1f18-636c-4b0c-bd3a-31d05e70a45c, Initiating User: 203d2816-3430-4766-80a1-933592357c96
</TraceText>
</OrganizationServiceFault>
Hi Mahesh,
Please refer below url for reference:
pravinpawarweb.wordpress.com/.../alert-confirmation-error-pop-up-in-dynamics-365v9-0
This is an example from microsoft
var confirmStrings = { text:"This is a confirmation.", title:"Confirmation Dialog", subtitle: "test subtitle", "cancelButtonLabel": "Amend", confirmButtonLabel: "Reactivate" };
var confirmOptions = { height: 200, width: 500};
Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
function (success) {
if (success.confirmed)
console.log("Dialog closed using OK button.");
else
console.log("Dialog closed using Cancel button or X.");
});
it seems you don't have the parameters for buttons. The confirm button could be your reactivate and the cancel button could be your amend. Just an idea
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156