Hi, I’ve added a custom handler to the mobile view by following the article https://academy.creatio.com/docs/8.x/mobile/mobile-development/customiz…. Everything works great, but I’ve run into a few issues:
- I would like to make web service requests. Unfortunately, I couldn't find any equivalent to sdk.HttpClientService (from the desktop @creatio-devkit/common) inside @creatio/mobile-common. At the same time, I’m not sure how-or if it's even possible-to access the user context so I can retrieve the instance credentials and construct an authenticated request to Creatio.
- I’m trying to read a system setting value, but it always returns null. No amount of synchronization, cache clearing, etc., seems to help. Here is the code I'm using:
const sysSettings = new sdk.SysSettingsService();
const siteUrl = sysSettings.getValueByCode('SiteUrl');- What is the best way to handle error logging on iOS? I tried using Logger.console('test'), but it doesn't work at all.
Like
Hello,
In order to call your service inside the mobile handler, you need to use tools like XMLHttpRequest . With it, you can call any http link, including any service you need. It can also be used to get the system setting value if you configure a specific service that will return it.
As for logs inside the handler, I don't know if Logger.console is dependent on OS, but it definitely works on Android. Perhaps you are just searching the logs in the wrong place?
Hi, thanks for the reply.
Inside the handler I'm using the fetch API. Generally, making requests works - I can query the Creatio instance and the requests are visible in Request.log. The problem is that they are unauthenticated. No cookies are sent with the request, so the server has no way to identify the specific user. From within the handler itself, I was also unable to read any information about the current user. I tried hardcoding authentication as Supervisor, but it seems like the Cookie header is being ignored and I keep getting a 302 redirect to the login form.