Trigger and SSO

Hi,

Currently troubleshooting a problem I've got with SuperOffice configured with Windows authentication in IIS. All components which I've tested works fine, including webtools etc. However I have an issue when it comes to triggers from service.

Right now I have just created a new trigger script on "Sales: After saving sale". I have not scripted anything and just have it enabled, this results in the following error given in Sales when trying to save the sale:

This has been followed as well as the other SSO article:

https://community.superoffice.com/en/technical/Forum/rooms/topic/superoffice-product-group/customer-service/new-requirements-for-service-and-sso-installations/

Also the SymmetricKeys are the same across the board. The error occurs whenever there is a trigger enabled, even if no scripts are added.

Anyone know of a solution to this problem?

Entry in the logfile:

Level: Error
At: 11:21:33

Element:
Message: Service call CustomerService.ExecuteEventHandlers failed with exception
CustomerService.ExecuteEventHandlers
Type: SuperOffice.Exceptions.SoException
Details:
at SuperOffice.CRM.Services.Implementation.CustomerServiceAgentLocal.ExecuteEventHandlers(EventData eventData)
at SuperOffice.Web.UI.EventHandler.CheckEventHandlers(IDataHandler datahandler, Boolean beforeSave, Boolean& wasBlocked, String& message, StringDictionary& stateValues)

Inner Element:
Message: The remote server returned an error: (401) Unauthorized.
Details:
at System.Net.HttpWebRequest.GetResponse()
at SuperOffice.CRM.Services.Implementation.ServiceFacades.ServiceFacade.HttpRequestAjaxService(String methodName, String arguments)
at SuperOffice.CRM.Services.Implementation.ServiceFacades.ServiceFacade.CallService(String methodName, String arguments)
at SuperOffice.CRM.Services.Implementation.CustomerServiceServiceFacade.ExecuteEventHandlers(EventData eventData)
at SuperOffice.CRM.Services.Implementation.CustomerServiceAgentLocal.ExecuteEventHandlers(EventData eventData)

Environment info:
User: sunorway (116) - Authorized
Role: (Employee)Administrator:
SingleThreadMode: False
TS.SoHttpContextProvider.SetNull.User:
SuperOffice.Security.Principal.SoCredentialsIdentity

TS.SoHttpContextProvider.SetNull.StackTrace:
at SuperOffice.Web.Security.HttpContextProvider.SetCurrentContext(SoContextContainer newContext)
at SuperOffice.SoSession.Dispose()
at SuperOffice.WebTools.AspNet.NetserverUserContextProvider.GetFor(IRequest request)
at SuperOffice.WebTools.AspNet.Web.WebToolsConnection.<>c__DisplayClass1_0.<AuthorizeRequest>b__0()
at SuperOffice.WebTools.AspNet.Web.WebToolsConnection.WithWebToolsLogContext[T](Func`1 action)
at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(IDictionary`2 environment)
at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__3.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.Owin.Mapping.MapMiddleware.Invoke(IDictionary`2 environment)
at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__3.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.Owin.Mapping.MapMiddleware.Invoke(IDictionary`2 environment)
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.<RunApp>d__7.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.RunApp(Func`2 entryPoint, IDictionary`2 environment, TaskCompletionSource`1 tcs, StageAsyncResult result)
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.BeginEvent(Object sender, EventArgs e, AsyncCallback cb, Object extradata)
at System.Web.HttpApplication.AsyncEventExecutionStep.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)


TS.SoHttpContextProvider.SetNull.ThreadName:
(null)

Database type: MSSQL - 10
Database: \\SQLTEST1\(CRM7), Database serial #: REMOVED, Database Expiration Date: den 12 januari 2021
DatabaseServer: SQLTEST1
DatabaseName: 
SerialNumber: REMOVED
Version: SuperOffice NetServer 8.5 Release (Build: Release85_C-2020.02.11-04)
Version.Assembly: 8.5.0.0
Version.File: 8.5.7346.1605
Version.BuildLabel: Release85_C-2020.02.11-04
ContextIdentifier: Default
MachineName: 
StackTrace: at SuperOffice.Diagnostics.SoLogger.LogError(Exception ex)
at SuperOffice.Web.UI.EventHandler.CheckEventHandlers(IDataHandler datahandler, Boolean beforeSave, Boolean& wasBlocked, String& message, StringDictionary& stateValues)
at SuperOffice.Data.DataDispatcher.Save(String DataHandlerId, Boolean& wasBlocked, EventAction`5 BeforeSave, EventAction`5 AfterSave)
at SuperOffice.DCF.Web.UI.PageBuilderHelper.SaveFromControl(ICard card, String[] dataHandlers)
at SuperOffice.CRM.Web.UI.Controls.TabbedCard.OnSave()
at SuperOffice.DCF.Web.UI.Controls.PageBuilder.OnPreRender()
at SuperOffice.DCF.Web.UI.Controls.PageBuilder._page_LoadComplete(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.OnLoadComplete(EventArgs e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.default_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\superoffice\2554e4a0\bee4517e\App_Web_q1op0dzo.8.cs:line 0
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)

RE: Trigger and SSO

Seems like NetServer is unable to talk to Service over the facades (that means the NetServer process is trying to talk to ajax.fcgi), and it seems to give a 401, which is unauthorized.

In order to determine if it is due to authorization, could you turn of Windows Authentication on the "scripts" folder in IIS (where among ajax.exe lives). Does it work then?

Av: Stian Andre Olsen 26. feb 2020

RE: Trigger and SSO

We had the same problem. What we ended up to do was make sure Blogic.fcgi/Blogic.exe got Anonymous Authentication - in addition to Windows Auth.

Av: Arild Eik 26. feb 2020

RE: Trigger and SSO

It does indeed work when setting it to anonymous auth, guess that's what I'll be doing. 

Thanks.

Av: Marius Gabrielsen 26. feb 2020

RE: Trigger and SSO

Just had a similar problem - same error message when a trigges was (supposed to be) fired.

I tried restart IIS, reinstall, giving full right to script (and hole Customer Service directory). But did not help.

After restarting the server this morning - everything seem to work... Ie restart might also help solve the problem.

Av: Morten Larsen 15. jan 2021

RE: Trigger and SSO

Hi All,

I am getting the same message when I try to implement any triggers – in the case below I have enabled/triggered an ‘after company save’ trigger event.

The log file is showing a General 500 Internal server error – see below.

I have tried the suggestions in this post, but the issue persists.

Does anyone have any other suggestions that might help me get resolved?

Many Thanks,

Andy

 

Category: SuperOffice.Exceptions.SoException EventId: 0 LogExceptionError

message: Service call CustomerService.ExecuteEventHandlers failed with exception CustomerService.ExecuteEventHandlers USERNAME REMOVED - Authorized (Employee)Admin User Group 2017: SuperOffice.Security.Principal.SoCredentialsIdentity at SuperOffice.Web.Security.HttpContextProvider.SetCurrentContext(SoContextContainer newContext) at SuperOffice.SoSession.Dispose() at SuperOffice.WebTools.AspNet.NetserverUserContextProvider.GetFor(IRequest request) at SuperOffice.WebTools.AspNet.Web.WebToolsConnection.<>c__DisplayClass1_0.<AuthorizeRequest>b__0() at SuperOffice.WebTools.AspNet.Web.WebToolsConnection.WithWebToolsLogContext[T](Func`1 action) at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(IDictionary`2 environment) at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__3.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.Owin.Mapping.MapMiddleware.Invoke(IDictionary`2 environment) at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__3.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.Owin.Mapping.MapMiddleware.Invoke(IDictionary`2 environment) at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.<RunApp>d__7.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.RunApp(Func`2 entryPoint, IDictionary`2 environment, TaskCompletionSource`1 tcs, StageAsyncResult result) at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.BeginEvent(Object sender, EventArgs e, AsyncCallback cb, Object extradata) at System.Web.HttpApplication.AsyncEventExecutionStep.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) Preference.GetPreferences.NY.LAM.Default.393 MSSQL - 12 \\REMOVED\SuperOffice8 (crm8), Database serial #: SERIAL REMOVED, Database Expiration Date: 14 June 2022 CUSTOMER NAME REMOVED SuperOffice8 SERIAL REMOVED SuperOffice 9.2 R7 NetServer 9.2 Release (Build: Release92R7_2021.04.27-02) 9.2.0.0 9.2.7787.1301 Release92R7_2021.04.27-02 Default CUSTOMER NAME REMOVED NetServer Service call CustomerService.ExecuteEventHandlers failed with exception CustomerService.ExecuteEventHandlers at SuperOffice.CRM.Services.Implementation.CustomerServiceAgentLocal.ExecuteEventHandlers(EventData eventData) at SuperOffice.Web.UI.EventHandler.CheckEventHandlers(IDataHandler datahandler, Boolean beforeSave, Boolean& wasBlocked, String& message, StringDictionary& stateValues) SuperOffice.Services.Implementation The remote server returned an error: (500) Internal Server Error. at System.Net.HttpWebRequest.GetResponse() at SuperOffice.CRM.Services.Implementation.ServiceFacades.ServiceFacade.HttpRequestAjaxService(String methodName, String arguments) at SuperOffice.CRM.Services.Implementation.ServiceFacades.ServiceFacade.CallService(String methodName, String arguments) at SuperOffice.CRM.Services.Implementation.CustomerServiceServiceFacade.ExecuteEventHandlers(EventData eventData) at SuperOffice.CRM.Services.Implementation.CustomerServiceAgentLocal.ExecuteEventHandlers(EventData eventData) System Exception: SuperOffice.Exceptions.SoException: Service call CustomerService.ExecuteEventHandlers failed with exception CustomerService.ExecuteEventHandlers ---> System.Net.WebException: The remote server returned an error: (500) Internal Server Error. at System.Net.HttpWebRequest.GetResponse() at SuperOffice.CRM.Services.Implementation.ServiceFacades.ServiceFacade.HttpRequestAjaxService(String methodName, String arguments) at SuperOffice.CRM.Services.Implementation.ServiceFacades.ServiceFacade.CallService(String methodName, String arguments) at SuperOffice.CRM.Services.Implementation.CustomerServiceServiceFacade.ExecuteEventHandlers(EventData eventData) at SuperOffice.CRM.Services.Implementation.CustomerServiceAgentLocal.ExecuteEventHandlers(EventData eventData) --- End of inner exception stack trace --- at SuperOffice.CRM.Services.Implementation.CustomerServiceAgentLocal.ExecuteEventHandlers(EventData eventData) at SuperOffice.Web.UI.EventHandler.CheckEventHandlers(IDataHandler datahandler, Boolean beforeSave, Boolean& wasBlocked, String& message, StringDictionary& stateValues)

Av: Andy Chaney 19. okt 2021

RE: Trigger and SSO

I'm having the same issue, with internal server error (500). This is in the customers test environment and the trigger is 'Sales: Before saving sale' but no trigger seems to work. Triggers seems to be running in production (at least for my user).

I've tried to different users, with and without windows login.

Version: 9.2
NetServer: SuperOffice 9.2 Build Release92_C-2020.12.15-04

/ Peter

-------------------------
Level: Error
At: 14:24:14

Element:
Message: Service call CustomerService.ExecuteEventHandlers failed with exception
CustomerService.ExecuteEventHandlers
Type: SuperOffice.Exceptions.SoException
Details:
at SuperOffice.CRM.Services.Implementation.CustomerServiceAgentLocal.ExecuteEventHandlers(EventData eventData)
at SuperOffice.Web.UI.EventHandler.CheckEventHandlers(IDataHandler datahandler, Boolean beforeSave, Boolean& wasBlocked, String& message, StringDictionary& stateValues)

Inner Element:
Message: The remote server returned an error: (500) Internal Server Error.
Details:
at System.Net.HttpWebRequest.GetResponse()
at SuperOffice.CRM.Services.Implementation.ServiceFacades.ServiceFacade.HttpRequestAjaxService(String methodName, String arguments)
at SuperOffice.CRM.Services.Implementation.ServiceFacades.ServiceFacade.CallService(String methodName, String arguments)
at SuperOffice.CRM.Services.Implementation.CustomerServiceServiceFacade.ExecuteEventHandlers(EventData eventData)
at SuperOffice.CRM.Services.Implementation.CustomerServiceAgentLocal.ExecuteEventHandlers(EventData eventData)

Environment info:
User: NNNN (nn) - Authorized
Role: (Employee)Customer Service-administratör: Kan administrera Customer Service-data
SingleThreadMode: False
TS.SoHttpContextProvider.SetNull.User:
SuperOffice.Security.Principal.SoCredentialsIdentity

TS.SoHttpContextProvider.SetNull.StackTrace:
at SuperOffice.Web.Security.HttpContextProvider.SetCurrentContext(SoContextContainer newContext)
at SuperOffice.SoSession.Dispose()

Av: Peter Borg 21. okt 2021

RE: Trigger and SSO

Did you find a solution to this Peter ? 

We have the same issue and tried with enabling windows and anonymous authentication with same error. 
We also performed a restart of the server without any effect.

Av: Ummair Tahir 22. okt 2021

RE: Trigger and SSO

No I did not. It's not worth the time to try to fix it. Triggers are to unreliable at least for onpremise. I decided to use webhooks instead. They're more reliable and they always fire when a contact is updated. There are some drawbacks to them but that's life...

Drawbacks with triggers

1. Unreliable (for onpremise)

2. They only fire from specific screens in the UI so if you want to enforce certain rules you may end up having to use webhooks anyway since uses may find sneaky ways to bypass the rules.

Drawbacks with webhooks

1. They don't give you the complete picture of what's been updated. Only fields updated on main table are listed (No user defined fields!). No before/after update values.

2. No way to communicate with user interface or prevent updated (Which is perfectly understandable given the nature of a web hook).

Please note that this is based on my experience up until SO 9.2, some of the above limitations may have been removed since then.

Av: Peter Borg 25. okt 2021

RE: Trigger and SSO

You can use webhook mechanism to invoke a CRM script.

Since these are part of the installation, not off site, they get the before+after values passed in as inputs.

They still won't get user defined field values, but you can't have everything.

Av: Christian Mogensen 25. okt 2021

RE: Trigger and SSO

I have again had this CustomerService.ExecuteEventHandlers issue.

In this case it was caused by a wrong symmetrickey in one of the netserver web.config files (in my installation I needed 2 netserver installations and one of them did not have the same symmetrickey as the other and the CS config file)

symmetrickey and symmetricsecret need to be equal in alle web.config (Netserver) and config (Service) files involved in the installation

Av: Morten Larsen 28. okt 2021