Hi Community, 

 

I have written a business rule that, when a boolean field has been set to true in the mobile app, stores the current timestamp in another separate date/time field: 

 

Terrasoft.sdk.Model.addBusinessRule("Activity", {
    name: "SetTimestampOnCheckForTriggeredField",
    ruleType: Terrasoft.RuleTypes.Custom,
    triggeredByColumns: [
        "InnEndSiteVisitCheck", "InnEndTravelInCheck", "InnEndTravelOutCheck",
        "InnStartSiteVisitCheck", "InnStartTravelInCheck", "InnStartTravelOutCheck"
    ],
    events: [Terrasoft.BusinessRuleEvents.ValueChanged],
 
    executeFn: function(record, rule, column, customData, callbackConfig) {
        // Mapping of boolean fields to their corresponding date-time fields
        var fieldMapping = {
            "InnEndSiteVisitCheck": "InnEndSiteVisitTime",
            "InnEndTravelInCheck": "InnEndTravelInTime",
            "InnEndTravelOutCheck": "InnEndTravelOutTime",
            "InnStartSiteVisitCheck": "InnStartSiteVisitTime",
            "InnStartTravelInCheck": "InnStartTravelInTime",
            "InnStartTravelOutCheck": "InnStartTravelOutTime"
        };
 
        // Get the boolean value of the triggered field
        var isCheckTrue = record.get(column);
 
        // Check if the boolean field is true
        if (isCheckTrue && fieldMapping[column]) {
            // Set the corresponding date-time field to the current date/time
            var currentDateTime = new Date();
            record.set(fieldMapping[column], currentDateTime);
        }
 
        // Asynchronous callback to indicate the rule has been processed
        Ext.callback(callbackConfig.success, callbackConfig.scope, [true]);
    }
});

 

I now want to be able to show a warning message that gives an option to 'cancel' or 'confirm' when a user attempts to set one of these booleans to false. 

 

The box would need to be shown after an attempt to change the booleans value, halting this action until confirmed  - if the action is not prevented before confirmation and the 'cancel' option merely reverts the boolean to being true, the old timestamp would be lost with the new value being representative of the time of cancellation (which is not what I desire).

 

The following post presents a similar requirement: Pop-up with options in mobile application | Community Creatio

 

However, guidance given points to a push notification (which I can't envision helping as I require an option in the app that temporarily halts the setting of the boolean to false), or to use Terrasoft.MessageBox.showMessage, which from what I can tell can only produce a message box (no option to cancel or confirm). 

 

I have also thought about writing individual rules that set each field to be disabled once it has been checked:

 

// Disable the InnEndSiteVisitCheck field after it is checked
Terrasoft.sdk.Model.addBusinessRule("Activity", {
    name: "DisableInnEndSiteVisitCheck",
    ruleType: Terrasoft.RuleTypes.Activation,
    triggeredByColumns: ["InnEndSiteVisitCheck"],
    events: [Terrasoft.BusinessRuleEvents.Load, Terrasoft.BusinessRuleEvents.ValueChanged],
    conditionalColumns: [
        { name: "InnEndSiteVisitCheck", value: true }
    ],
    dependentColumnNames: ["InnEndSiteVisitCheck"]
});

 

However, this is not as flexible as I would want as users may set field values to true by mistake. Even then, the rule I have written does not seem to work as I get a server error when syncing in the mobile app after adding it - perhaps this is because two rules are initiated by the same event? 

Any help on this would be greatly appreciated, thanks in advance!

Like 1

Like

2 comments
Best reply

Hello,

 

Terrasoft.MessageBox also contains the showConfirmation method that can be called to show the confirmation box:

Also you can specify the callback function that will be called upon clicking the "confirm" button (using the yesCallback function inside the object that is passed as an argument into the showConfirmation method or "negative" button (the noCallback function should be created). So you can use it in your development.

Hello,

 

Terrasoft.MessageBox also contains the showConfirmation method that can be called to show the confirmation box:

Also you can specify the callback function that will be called upon clicking the "confirm" button (using the yesCallback function inside the object that is passed as an argument into the showConfirmation method or "negative" button (the noCallback function should be created). So you can use it in your development.

Hi Oleg,

 

Thanks for your reply, this has helped to develop a solution!

Show all comments

Dear community!

 

Does someone thinks about such a feature?

To let operator user work with chat channel from mobile application?

Maybe, Creatio team have it in the backlog?

Like 0

Like

1 comments

Hello,

 

Currently, there is no possibility to work with chats in the mobile application. However, we have already registered a task for our R&D team to explore the possibility of implementing this functionality in future.

 

Thank you for your question!

Show all comments

Hi there,

 

I am trying to create a mobile app which has custom buttons which, when pressed, record a timestamp. I have created a new workplace in the mobile application wizard and have added the section where I want to include these buttons. When I generate this section, four client modules are created as shown in the image attached. Can I configure these custom buttons in one of these client modules? Some documentation recommends configuration in MobileFUI... client modules but I have no MobileFUI client modules for my new section.
 

 

Thanks 

Like 1

Like

2 comments

Hello,
The process of adding a new button in the mobile app involves creating your own remote module, basically, the list of things you need to do is following:

  1. 1) Create TypeScript project for remote module.
  2. 2) Create a custom request in remote module.
  3. 3) Create custom request handlers using remote module.
  4. 4) Register handler in remote module.
  5. 5) Build project and upload changes to Creatio.
  6. 6) Add button to the page using metadata.
  7. 7) Check functionality.
  8. Also, you need to add and enable EnableMobileSDK feature in the features section.
    An example of adding a custom module can be found in this article. In your case, the code of the remote module should look like this:
  9. import {
    	BaseRequest,
    	BaseRequestHandler,
    	CrtModule,
    	CrtRequestHandler,
    	Logger,
    	CrtRequest,
    	ModalPresenter,
    	bootstrapCrtModule,
    	DoBootstrap,
    } from '@creatio/mobile-common';
     
    @CrtRequest({
    	type: 'crt.MyButtonRequest',
    })
    export class MyButtonRequest extends BaseRequest {
    	public message?: string;
    }
     
    @CrtRequestHandler({
    	requestType: 'crt.MyButtonRequest',
    	type: 'usr.MyButtonRequest',
    	scopes: ['UsrMobileUsrUserModuleRecordPageSettingsDefaultWorkplace_Root'],
    })
    export class UsrMyButtonRequestHandler extends BaseRequestHandler<MyButtonRequest> {
    	public async handle(request: BaseRequest): Promise<unknown> {
    		var message: string | undefined = (request as MyButtonRequest).message;
    		if (message) {
    			Logger.console('Request message: ' + message);
    			ModalPresenter.showSnackBar('Message title', message);
    		}
    		return this.next?.handle(request);
    	}
    }
     
    @CrtModule({
    	requestHandlers: [
    		UsrMyButtonRequestHandler,
    	],
    })
    export class UsrModule implements DoBootstrap {
    	bootstrap(): void {
    		bootstrapCrtModule('UsrModule', UsrModule);
    	}
    }

The difference with the article above is a way to add a button. In order to do so in one of the schemas you showed (depending on where you want to locate a button) you need to add a code of the button to a viewConfigDiff:

{
	"operation": "insert",
	"name": "settings",
	"values": {
		"entitySchemaName": "UsrUserModule",
		"details": [],
		"columnSets": [],
		"localizableStrings": {
			"SocialMessageDetailCaptionUsrUserModule_caption": "Feed",
			"AttachmentsDetailCaptionUsrUserModule_caption": "Attachments",
			"primaryColumnSetUsrUserModule_caption": "General information"
		},
		"settingsType": "RecordPage",
		"operation": "insert",
        "viewConfigDiff": "[{\"operation\": \"insert\", \"name\": \"MyButton\", \"parentName\": \"UsrUserModule_PrimaryTab_Body_primaryColumnSet\", \"propertyName\":\"items\", \"values\": {\"type\":\"crt.Button\",\"caption\": \"Click here\", \"color\":\"primary\",\"clicked\":{\"request\": \"crt.MyButtonRequest\", \"params\": { \"message\": \"Some test message\" }}}}]"
	}
}

Dmytro Vovchenko,

Thank you!

Show all comments

Hello, I recently started working with Creatio Mobile. I have downloaded the files and was able to create the Creatio APK through the SDKConsole utility. I have a question: how can I add a page within the application? I see that most of the app is based on WebView. My goal is to import a library from Pub.dev (in my case, call_log) and implement it to display the data on a page within this app.

If anyone could help me, I would be very grateful. Thank you.

Like 0

Like

1 comments

Hello,
In the mobile application there is an abillity to open custom JS pages using the handler logic, an example of such handler:

const openCustomPageRequest: OpenCustomWebViewPageRequest = {
   type: 'crt.OpenCustomWebViewPageRequest',
   $context: request.$context,
   controllerName: 'Terrasoft.controller.MobileSyncLogPage',
   viewXClass: 'Terrasoft.view.MobileSyncLogPage',
   parameters: {
       "customParam": 1
   }
};
HandlerChainService.instance.process(openCustomPageRequest);

controllerName - class name of JS controller 
viewXClass - class name of JS view 
parameters - additional parameters of custom page. To get the parameter call this method inside the controller this.getPageHistoryItem().getRawConfig().customParam

This handler should be added via the remote module (see this article) and using the @creatio/mobile-common library enabling the feature EnableMobileSDK in the Features page.

Show all comments

When making changes to the section list and/or section pages for the mobile app, should I create a new packages or is it ok to leave the current package as "custom" and make the changes via the mobile application wizard?

Like 0

Like

1 comments

Hi!

It is normal to leave the current package as "custom". You can change the package only if you want to keep some functionality in a separate package. 

Best regards, 
Anton

Show all comments

Hello, I would like to get assistance on how to implement the "Account Addresses" detail within contacts section, inside activities for the mobile app. When you view a contact in the mobile app and see their addresses in the "Account addresses" detail you can click the address and it will open the native maps app on your phone so you can get directions. 

 

How do I set this up within the activities section of the mobile app so that if I put in a location, it can be a clickable field similar to Contacts section?

 

Also, is there a way to pull in the contact's address to the activity that can be clicked to open the maps app?

 

Thank you,

 

Eric

Like 2

Like

1 comments

Hello Eric,
Thank you for your question.

Yes, it is possible. For the example, in Configuration menu i added an object (UsrActivityAddress) with a parent object - BaseAddress and a column UsrActivity with data source - Activity, which links UsrActivityAddress with Activity. 

Then go to Mobile application wizard. Here i created a custom workplace and added Activity section to the workplace. In page setup:


Save and go to Configuration. There search you need to search for the name of the detail that mobile wizard provides for the detail on the page you just added. For this search for MobileActivityRecordPageSettings[plus the name of workplace you are adding activity with address to]. In my case it was UsrMobileActivityRecordPageSettingsUsrTestMobile. After that scroll down and find items which represent fields that you added to mobile section page wizard. The name of the detail looks might look like this "UsrSchema302ae53eDetailEmbeddedDetail". Copy the value and go to the top of file.

Then you need to add viewConfigDiff:1
Here you delete those details fields from you mobile page layout and you merge AddressPreview component. If the column name was Address in viewConfigDiff it becomes [name of your detail in mobile wizard]_ItemLayout_[column name]. 

Also note, that this component is not described on the Academy and designed for internal usage thus in not recommended for public usage in current version.

Hope this helps
 

Show all comments

Hello,

 

how is it possible to implement action to create account address by geolocation in mobile app?

 

I see, that Creatio field sales can get location of check-in. So, if we use similar functionality, we have just to find address of these coordinates.

Do you have any idea how to do that?

 

Thank you!

Vladimir

Like 2

Like

4 comments

Hi Vladimir! How are you? It seems you could use for example this service from Google Maps Platform:   https://developers.google.com/maps/documentation/geocoding/requests-rev…

Uriel Nusenbaum,

Thank you for this information. Do you know, does this service require any lincense from Google?

 

Vladimir Sokolov,

You should configure an API Key follow this article: https://developers.google.com/maps/documentation/geocoding/cloud-setup and here you have the pricing information: https://mapsplatform.google.com/pricing/
You have the option to try the service and several requests per month for free.
Regards.
 

Hello Vladimir,
Thank you for your question.

After consulting with R&D team i got some information regarding your case. Mobile phones have build-in API to work with geolocation however currently it is impossible to customize our mobile application directly. Javascript also has some methods to determine user's geolocation like getCoordinates. 
So the possible workaround right now is to create service that will receive coordinates from and send them to an external service like Google Geolocation.

Hope this helps and let me know if you any question left.

Show all comments

Hello friends!

 

We've been working on creating custom branded mobile applications for android and iOS.  Still working on finishing iOS, but Android is done, with the exception of one issue that I cannot resolve.  Everything is branded using our images, with the exception of the launcher icon itself.  I added all of our custom images to the src folder and all of the images in the application were updated as expected (including notification icons). Any icon used for the launcher should be in the "mipmap_xxxx" folders and we have added equivalents in the SDKConsoleUtility/src folder.  We know this is working, since the notification icons are using our custom icons.  As a final attempt, I replaced every instance of a creatio icon image I could find in all of the source repository files and still the launcher icon is the creatio icon.  
 

Has anyone successfully custom branded the mobile app for Android and was able to use a custom application launcher icon?


As a reference, we've been following the academy article here:  Brand and publish mobile apps basics | Creatio Academy

Please let me know what I'm missing.

Thank you!

Jeremy


 

Like 0

Like

4 comments

Hello Jeremy,

To change the launcher icon you have to specify the "app_icon_path" in the SDK.config file from the article that you've mentioned

For example:

"app_icon_path": "../res/AppIcon.png"

Anhelina,

Hi Anhelina

 

The config value "app_icon_path"  is for iOS only, according to the documentation here: SDKConsole utility parameters | Creatio Academy

 

For Android, there is a value for "native_resources_path" that is the path to the src folder with the custom image resources.  This value is set and working as all of other images in the app have been referencing our custom images there. It's just not using our image for the application launcher icon.

 

Any ideas?

 

Jeremy Couzens,

It usually works with native_resources_path for Android. The default folder is res/android/res, and folders with resources should be placed inside, as is done in Android projects. The directory can contain subdirectories with drawable, drawable-xhdpi, and other icons.

Maybe the reason is the file type? You can use the xml and webp
In another case, it's hard to understand the reason remotely.

Hi Jeremy, 

I'm currently working on the branding of the mobile application. 
Can you tell me how did you change the login page logo, by default it's the bpm'online logo and I cannot make it change to our custom image.

Show all comments

Hi guys,

 

Is there a way to sort a detail by a specific field in Freedom Mobile? I'm using this approach that works in Classic, but it does not seem to work when I switch to the Freedom version:

 

Terrasoft.sdk.GridPage.setOrderByColumns("Account", {
    column: "CreatedOn",
    orderType: Terrasoft.OrderTypes.DESC
});

 

Thanks!

Like 0

Like

1 comments

Hello,

 

This approach won't work in Freedom UI, this one is for classic UI. Here is the example of the code for ActivityDetailV2EmbeddedDetail out-of-the-box

"ActivityDetailV2EmbeddedDetail": {
                "properties": {"readonly": true},
                "modelConfig": {
                    "path": "ActivityDetailV2EmbeddedDetailDS",
                    "cacheConfig": {},
                    "sortingConfig": {
                        "default": [{
                            "columnName": "CreatedOn",
                            "direction": "asc"
                        }],
                        "name": "Attribute_ActivityDetailV2EmbeddedDetail_SortingConfig"
                    },
                    "name": "Attribute_ActivityDetailV2EmbeddedDetail_ModelConfig"
                },
                "name": "Attribute_ActivityDetailV2EmbeddedDetail"
            },

added to the MobileCaseRecordPageSettings (edit page of the case section in mobile). The code for your detail should be found in the same schema and modified.

Show all comments

Hi team, 

 

I have a case when after trigger record.save() on the page I want to reload the embedded details. The record is saved correctly and entered on the success method. How can force the reload of the store for the detail?

 

Thanks!

Like 0

Like

1 comments

Hello Federico,

 

It should be tested, but if I remember correctly if controller is used for the action the

 

controller.refreshDirtyData();

 

method can be called to force reload all details on the page. You can also find its uage in the MobileActivityGridPageControllerV2 from the Mobile package.

 

There is also an option that our R&D team used, the case was the following: changes were applied on the edit page and data on all previous pages should've been updated. For this purpose the following approach was used:

completeDataSaving: function(operation) {
		let operationConfig = this.createPageOperationConfig(operation);
		return Terrasoft.BaseEditPageController.superclass.completeDataSaving.apply(this, arguments).then(() => {
			let pageHistoryItem = this.getPageHistoryItem();
			let useOptimisticEditing = this.useOptimisticEditing();
			if (useOptimisticEditing) {
				Terrasoft.PageNavigator.refreshPreviousPages(operationConfig, pageHistoryItem);
			} else {
				Terrasoft.PageNavigator.markPreviousPagesAsDirty(operationConfig);
			}
			this.doAfterSaving(operationConfig);
		});
	}

But this is more for the previous edit pages rather than for the current edit page. Examples of Terrasoft.PageNavigator.refreshPreviousPages() can be found in base-edit-page-controller.js and in the base-preview-page-controller.js

Show all comments