I am trying to get the current user role in mobile but it is not working !

 

Terrasoft.sdk.Model.addBusinessRule("Activity", {

  name: "GetRoleFromtheUser",

  ruleType: Terrasoft.RuleTypes.Custom,

  triggeredByColumns: ["UsrVisitType","UsrTypeDeVisiteManager"],

  events: [Terrasoft.BusinessRuleEvents.ValueChanged, Terrasoft.BusinessRuleEvents.Save],

  executeFn: function(record, rule, column, customData, callbackConfig) {



    var myrecord = record; 

    var currentUser =Terrasoft.CurrentUserInfo.userId;

    var store = Ext.create('Terrasoft.store.BaseStore', {

      model: 'SMVwUserRoles'

    });

    var queryConfig = Ext.create('Terrasoft.QueryConfig', {

      columns: ['SMId', 'SMUserName', 'SMRoleName'],

      modelName: 'SMVwUserRoles'

    });

    store.loadPage(1, {

      queryConfig: queryConfig,

 

      filters: Ext.create('Terrasoft.Filter', {

        property: 'SMId',

        value: currentUser

      }),

      callback: function(records, operation, success) {

        var loadedRecord = records[0];

        if (loadedRecord) {

          var role = loadedRecord.get('SMRoleName');                                                                                                    

          if (role=='Sales Management') {                                                                                                                   

            record.changeProperty("UsrVisitType", {

                 hidden: true,

              readOnly: true

               });

          }else{

            record.changeProperty("UsrTypeDeVisiteManager", {

                 hidden: true

               });

          }

          }

        },

      });



Ext.callback(callbackConfig.success, callbackConfig.scope, [hidden,readOnly]); 

  }

});

Any idea please ?

Like 1

Like

1 comments

Hello!

You’re thinking in a right way and I would recommend you to change the logic of getting the role a bit. I tested this code on basic table SysAdminUnitInRole where we have a column SysAdminUnitRoleId

var currentUser =Terrasoft.CurrentUserInfo.userId;
var store = Ext.create('Terrasoft.store.BaseStore', {
  model: 'SysAdminUnitInRole'
});
var queryConfig = Ext.create('Terrasoft.QueryConfig', {
  columns: ['SysAdminUnitRoleId'],
  modelName: 'SysAdminUnitInRole'
});

Variable records structure looks like this:

 

And each class contains SysAdminUnitRoleId:

 

I used ID from loadedRecord.get('SysAdminUnitRoleId') and it works for me to see the role. You can do it in two ways:

  1. Create a loop for each “records” element and check if SysAdminUnitRoleId is equal to the user's current role id
  2. If you want to use “role=='Sales Management'” you can create a new object to display extensions of ID and role names.

P.S. Check if you added models to MobileApplicationManifestDefaultWorkplace:

"Models": { 
			"Activity": {
			"RequiredModels": ["SysAdminUnitInRole"],
			"ModelExtensions": ["UsrActivityModel"],
			"PagesExtensions": []
		}
	},

 

Show all comments

Hi Community,

 

What is the correct syntax to add multiple or array of filter to store.loadPage in mobile. We've tried below but it is not working.

Like 0

Like

1 comments

Hello Fulgen,

 

Something like that:

...
var filtersConfig = {
				type: Terrasoft.FilterTypes.Group,
				logicalOperation: Terrasoft.FilterLogicalOperations.And,
				subfilters: [
					{
						property: "Order",
						value: currentOrderId
					},
					{
						property: "Product",
						value: productId
					}
				]
			};
...
store.loadPage(1, {
			isCancelable: true,
			filters: Ext.create("Terrasoft.Filter", filtersConfig),
			queryConfig: queryConfig,
			callback: function(loadedRecords, operation, success) {
...

 

Show all comments

I have been trying to remove the preview page from mobile app.

When I select on record i want to go directly to edit page and not preview page.

I tried to add this code to my Manifest, but it did not work:

Like 0

Like

4 comments

Hello,

 

8.0 interface account page has no preview page and edit page is opened automatically for it. So there is no need to remove preview page from this model.

Oleg Drobina

Hello,

then what is the solution ?

There is solution for this with the old versions?

Hello. I found a solution. You need to extend the grid controller and replace the openpreview to this:

That will open directly the edit page.

Show all comments

I'm trying to add a default filter to my account grid page in the mobile app so that it only imports accounts owned by the current user.

I've tried multiple solutions, but nothing worked, and this is my last one:

Like 0

Like

1 comments

Hello,

In order to add such filter you need to create a new module in the configuration with this code:

 Terrasoft.sdk.Module.addFilter("Account", Ext.create("Terrasoft.Filter", {
    type: Terrasoft.FilterTypes.Group,
    subfilters: [
		Ext.create("Terrasoft.Filter", {
			compareType: Terrasoft.ComparisonTypes.Equal,
			property: "Owner",
			valueIsMacros: true,
			value: "Terrasoft.ValueMacros.CurrentUserContactId"
		})
	]
}));

After this, you need to connect this module in the Manifest schema:

	"Models": {
		"Account": {
			"RequiredModels": [
				------
			],
			"ModelExtensions": [],
			"PagesExtensions": [
				--------,
				"UsrAccountOwnerFilterMobile"
			]
		}
	},

 

Show all comments

I have tried to add a business rule in app, when the page is in "freedom UI" mode it does not work, but when i uncheck the freedom UI it works.

Same when adding actions to mobile!

Like 0

Like

2 comments

FreedomUI mobile for now supports business rules for the object job can set it with a business rule designer. Page business rules for mobile FreedomUI can set up only in metadata mode.

Web pages are Classic or Freedom UI? Business rules for object work only if you use Freedom UI in mobile and web versions (if web version pages are classic and only mobile is Freedom it doesn't work).

Show all comments

I want to show column with cdde "UsrCapacite_camion" when field with code "UsrSegmentClient"=Distribution .

This is my code :

and here is my manifest:

Like 0

Like

6 comments

Hello,

 

It seems that the UsrSegmentClient column is a lookup and you need to use an actual Id here, not display value of the lookup (in the value: 'Distribution' part specify an actual Id of the record instead of the 'Distribution' value). That's why the rule doesn't do anything.

Oleg Drobina,

Hello,

Nothing changed unfortunately

!

 

developer,

 

Hello,

 

Indeed, tested the same locally and it didn't work. I've discussed this with our R&D team and in FreedomUI old approach with mobile app business rules won't work anymore, only in old UI. They also have a task to make it possible to develop business rules in Freedom UI using standard wizard in mobile app and they've prioritized this task.

Oleg Drobina,

Hi,



I read in 8.0.8 release, that 'Creatio mobile app now supports the operation of object-level business rules both online and offline.'



But as I've tried to use Object-level business rules, they works in web app, and don't work in mobile app (in both online and offline mode)



What then was mentioned in release note?



Kind regards,

Vladimir

Hi,



Any updates about business rules in mobile application using freedom ui ? as the business rules work only on old UI what approach to follow ?



Thank you in advance for your time and help,

Malek Sghaier,

 

If these are general business rules, it is better to configure them at the object level. In both mobile and web applications, these rules complement each other. Please find more information here

 

Business rules for the page itself can only be configured through metadata development.

 

 

 

 

Show all comments

Hi guys, did anyone try to integrate mapsly to Creatio mobile?

I need some guidance !

Is it only possible with adding Mapsly's Iframe ?

If yes where should i put the iframe ? in which Creatio schema ?

Thank you 

Like 0

Like

1 comments

Hello, in this case, we recommend reaching out to the technical support of Mapsly. You can use this email: help@mapsly.com 

Show all comments

Hello , i have this requirement where in creatio mobile app i need to have a map view .

I can't a map app outside of creatio . is there any solutions ? any proposition ? any way to help me integrate a map inside my mobile app instance ?

Like 0

Like

4 comments

Hello,

 

You can inspect the Account address detail as an example of integration with OpenStreetMaps in the system and Field Force application as an example of maps functionality on mobile apps.

Bogdan,

can you explain more please ?

Bogdan,

these posts are using maps from outside creatio , in my case i want the map view integrated within creatio map 

Show all comments

I am trying to access a local Creatio instance(deployed in Localhost port 9010 ) from Android Studio Emulator. I am using the URL  10.0.2.2 to access my actual machine based on

https://stackoverflow.com/questions/5528850/how-do-you-connect-localhost-in-the-android-emulator)

While Logging in I get an error

While Debugging:

Exception

Type: Terrasoft.SyncException
Message: An error occurred while synchronizing
Stack trace: 
Class.logException(terrasoft-all-combined.js:7325:45)
Class.error(terrasoft-all-combined.js:7332:12)
Function.processFailure(terrasoft-all-combined.js:36689:24)
terrasoft-all-combined.js:36760:20
Object.callbackFromNative(cordova.js:295:52)
processMessage(cordova.js:1081:17)
processMessages(cordova.js:1104:9)
pollOnce(cordova.js:973:9)
pollOnceFromOnlineEvent(cordova.js:960:5)
Type: Terrasoft.Exception
Message: Could not complete request
Stack trace: 
com.creatio.core.net.RequestException: Could not complete request
	at com.creatio.core.net.RequestExceptionFactory.create(RequestExceptionFactory.java:28)
	at com.creatio.core.net.Request.getRequestException(Request.java:418)
	at com.creatio.core.net.Request.post(Request.java:355)
	at com.creatio.core.net.RequestItem.execute(RequestItem.java:30)
	at com.creatio.core.net.RequestManager.doExecuteRequest(RequestManager.java:181)
	at com.creatio.core.net.RequestManager.executeRequest(RequestManager.java:173)
	at com.creatio.core.net.RequestManager.post(RequestManager.java:87)
	at com.creatio.core.net.RequestManager.post(RequestManager.java:75)
	at com.creatio.core.service.Service.post(Service.java:133)
	at com.creatio.core.service.MobileMetadataService.load(MobileMetadataService.java:52)
	at com.creatio.app.sync.MetadataSyncAdapter.downloadMetadata(MetadataSyncAdapter.java:225)
	at com.creatio.app.sync.MetadataSyncAdapter.loadMetadata(MetadataSyncAdapter.java:86)
	at com.creatio.app.sync.MetadataSyncAdapter.startSync(MetadataSyncAdapter.java:57)
	at com.creatio.app.sync.SyncAdapter.synchronize(SyncAdapter.java:55)
	at com.creatio.app.sync.AppSyncAdapter.runSyncAdapter(AppSyncAdapter.java:121)
	at com.creatio.app.sync.AppSyncAdapter.syncMetadata(AppSyncAdapter.java:296)
	at com.creatio.app.sync.AppSyncAdapter.syncAllMetadata(AppSyncAdapter.java:153)
	at com.creatio.app.sync.AppSyncAdapter.startSync(AppSyncAdapter.java:60)
	at com.creatio.app.sync.SyncAdapter.synchronize(SyncAdapter.java:55)
	at com.creatio.app.sync.SyncRunner.runItem(SyncRunner.java:259)
	at com.creatio.app.sync.SyncRunner.doRun(SyncRunner.java:250)
	at com.creatio.app.sync.SyncRunner.run(SyncRunner.java:129)
	at com.creatio.app.sync.SyncRunner.run(SyncRunner.java:101)
	at com.creatio.cordova.plugin.tssynchronization.TSSynchronizationPlugin.runSync(TSSynchronizationPlugin.java:102)
	at com.creatio.cordova.plugin.tssynchronization.TSSynchronizationPlugin.syncApp(TSSynchronizationPlugin.java:356)
	at com.creatio.cordova.plugin.tssynchronization.TSSynchronizationPlugin.lambda$execute$6$com-creatio-cordova-plugin-tssynchronization-TSSynchronizationPlugin(TSSynchronizationPlugin.java:67)
	at com.creatio.cordova.plugin.tssynchronization.TSSynchronizationPlugin$$ExternalSyntheticLambda6.run(Unknown Source:6)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:919)
Caused by: java.net.ProtocolException: Expected leading [0-9a-fA-F] character but was 0x9d
	at com.android.okhttp.internal.http.Http1xStream$ChunkedSource.readChunkSize(Http1xStream.java:463)
	at com.android.okhttp.internal.http.Http1xStream$ChunkedSource.read(Http1xStream.java:437)
	at com.android.okhttp.okio.RealBufferedSource$1.read(RealBufferedSource.java:372)
	at java.io.FilterInputStream.read(FilterInputStream.java:133)
	at java.io.PushbackInputStream.read(PushbackInputStream.java:186)
	at com.creatio.core.util.StreamUtils.writeToOutputStream(StreamUtils.java:32)
	at com.creatio.core.net.DownloadRequest.readResponseInputStream(DownloadRequest.java:68)
	at com.creatio.core.net.Request.connect(Request.java:65)
	at com.creatio.core.net.Request.post(Request.java:340)
	... 27 more
 
Type: Terrasoft.Exception
Message: Expected leading [0-9a-fA-F] character but was 0x9d
Stack trace: 
java.net.ProtocolException: Expected leading [0-9a-fA-F] character but was 0x9d
	at com.android.okhttp.internal.http.Http1xStream$ChunkedSource.readChunkSize(Http1xStream.java:463)
	at com.android.okhttp.internal.http.Http1xStream$ChunkedSource.read(Http1xStream.java:437)
	at com.android.okhttp.okio.RealBufferedSource$1.read(RealBufferedSource.java:372)
	at java.io.FilterInputStream.read(FilterInputStream.java:133)
	at java.io.PushbackInputStream.read(PushbackInputStream.java:186)
	at com.creatio.core.util.StreamUtils.writeToOutputStream(StreamUtils.java:32)
	at com.creatio.core.net.DownloadRequest.readResponseInputStream(DownloadRequest.java:68)
	at com.creatio.core.net.Request.connect(Request.java:65)
	at com.creatio.core.net.Request.post(Request.java:340)
	at com.creatio.core.net.RequestItem.execute(RequestItem.java:30)
	at com.creatio.core.net.RequestManager.doExecuteRequest(RequestManager.java:181)
	at com.creatio.core.net.RequestManager.executeRequest(RequestManager.java:173)
	at com.creatio.core.net.RequestManager.post(RequestManager.java:87)
	at com.creatio.core.net.RequestManager.post(RequestManager.java:75)
	at com.creatio.core.service.Service.post(Service.java:133)
	at com.creatio.core.service.MobileMetadataService.load(MobileMetadataService.java:52)
	at com.creatio.app.sync.MetadataSyncAdapter.downloadMetadata(MetadataSyncAdapter.java:225)
	at com.creatio.app.sync.MetadataSyncAdapter.loadMetadata(MetadataSyncAdapter.java:86)
	at com.creatio.app.sync.MetadataSyncAdapter.startSync(MetadataSyncAdapter.java:57)
	at com.creatio.app.sync.SyncAdapter.synchronize(SyncAdapter.java:55)
	at com.creatio.app.sync.AppSyncAdapter.runSyncAdapter(AppSyncAdapter.java:121)
	at com.creatio.app.sync.AppSyncAdapter.syncMetadata(AppSyncAdapter.java:296)
	at com.creatio.app.sync.AppSyncAdapter.syncAllMetadata(AppSyncAdapter.java:153)
	at com.creatio.app.sync.AppSyncAdapter.startSync(AppSyncAdapter.java:60)
	at com.creatio.app.sync.SyncAdapter.synchronize(SyncAdapter.java:55)
	at com.creatio.app.sync.SyncRunner.runItem(SyncRunner.java:259)
	at com.creatio.app.sync.SyncRunner.doRun(SyncRunner.java:250)
	at com.creatio.app.sync.SyncRunner.run(SyncRunner.java:129)
	at com.creatio.app.sync.SyncRunner.run(SyncRunner.java:101)
	at com.creatio.cordova.plugin.tssynchronization.TSSynchronizationPlugin.runSync(TSSynchronizationPlugin.java:102)
	at com.creatio.cordova.plugin.tssynchronization.TSSynchronizationPlugin.syncApp(TSSynchronizationPlugin.java:356)
	at com.creatio.cordova.plugin.tssynchronization.TSSynchronizationPlugin.lambda$execute$6$com-creatio-cordova-plugin-tssynchronization-TSSynchronizationPlugin(TSSynchronizationPlugin.java:67)
	at com.creatio.cordova.plugin.tssynchronization.TSSynchronizationPlugin$$ExternalSyntheticLambda6.run(Unknown Source:6)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:919)

 

Like 0

Like

1 comments

Hello,

Unfortunately, we cannot help you with this problem because we don't use local environments via Android Studio. But, I can say that this is in fact possible. I managed to connect to localhost using 10.0.2.2.

Please take a closer look at the article you provided, maybe you missed some setting.

Also, look at this post, I hope it can help you fix this error.

Show all comments

Hello Community,

In the Mobile app there is no trace of the Filters in the Sections (Accounts, Contacts)

Filters seem to appear only in the Activities Section.

How should i add the filter (icon and functionality) to the most used Creatio sections (Accounts,Contacts) etc ?

Best regards,

Sasori

Like 0

Like

1 comments

Hello,

 

Filters are present in sections Accounts and Contacts in mobile applications in the latest versions.

Please try updating your mobile application to the latest available version.

If it doesn't fix the issue, please email us at support@creatio.com and we will check the matter for you.

 

Best regards,

Yuliya Gritsenko

Show all comments