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 Creatio community

 

I have developed a page using Freedom UI. I want to develop some core functions that i want to call in different Freedom UI screens. For example function calculate as shown below.

 

define("ApplicationFormSection_FormPage", /**SCHEMA_DEPS*/["@creatio-devkit/common"]/**SCHEMA_DEPS*/, function/**SCHEMA_ARGS*/(sdk)/**SCHEMA_ARGS*/ {
	function calculate(value1, value2) {
		return value1 + value2;
	}
	return {
		viewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/[..]/**SCHEMA_VIEW_CONFIG_DIFF*/,
		viewModelConfigDiff: /**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/[..]/**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/,
		modelConfigDiff: /**SCHEMA_MODEL_CONFIG_DIFF*/[..]/**SCHEMA_MODEL_CONFIG_DIFF*/,
		handlers: /**SCHEMA_HANDLERS*/[
			{
				request: "crt.HandleViewModelAttributeChangeRequest",
				handler: async (request, next) => {
					if (request.attributeName === "Field1" && !request.silent) {
						var sum = calculate(1, 2);
					}
					return next?.handle(request);
				}
			},
		 ]
	}

 

This approach doesn't work because every time i change the screen the function is removed automatically. 

 

Is there a way I can develop some core functions in a different module and call this module inside my "ApplicationFormSection_FormPage" freedom UI page?
Can you give an example for my case?

 

Best regards

Like 0

Like

1 comments

Hello,

A better approach is to use modules for page code. I try to add as little code to the page request handlers as possible and move all code to modules/classes. See https://customerfx.com/article/organizing-code-for-creatio-freedom-ui-pages-with-modules/

Ryan

Show all comments

Hi,

I want to run a web service on combobox changed event.

What is the syntax of register the handler in the client module file? 

(What do I need to write in viewConfigDiff --> values to execute the handler on the change event?)

 

Thanks,

Smadar

Like 0

Like

2 comments
Best reply

You can see how to respond to the change event here: https://customerfx.com/article/responding-to-an-event-when-a-field-is-c…

Also, for calling the web service see here https://customerfx.com/article/calling-configuration-web-services-from-…

Ryan

You can see how to respond to the change event here: https://customerfx.com/article/responding-to-an-event-when-a-field-is-c…

Also, for calling the web service see here https://customerfx.com/article/calling-configuration-web-services-from-…

Ryan

Thanks! It solved my problem :)

Show all comments

Hi all,



When this page opens, a process runs automatically, and the 'Mandatory Values' field is filled. The 'Mandatory Values' field specifies which fields should be compulsory to fill. Accordingly, based on the values in the 'Mandatory Values' field, I need to make related fields mandatory (required).

For example, if the 'Mandatory Values' field value is 'Package Name, Price,' I need to make the 'Package Name' and 'Price' fields required.

Can I run a function on the client side to make fields compulsory after the automatic process has run?

Like 2

Like

1 comments
Show all comments

Hi Team,

We have an issue when installing packages in the production environment some js files (Client module) and business Rules are not updated with new fields.

we make an overwrite page and section file properly in the custom package but the issue is only in production can't see new fields and business Rules in page and in js file



also we perform a compile all & Generate for all schemas but still same issue

Like 1

Like

2 comments

Hello,



Could you please elaborate on the issue? 



Are transferring modifications between environments by packages? 

Is it working properly on the website where it was developed?

Bogdan,

Hi  Bogdan, Thanks for reply 

Yes transferring modifications between environments by packages and it is work successfully on my development environment

Show all comments

Hello Community,

 

I wanted to validate Start date and enddate. For start date I will use current date to validate. But to validate EndDate I wanted the value of Startdate field. 

I want to know how to read the startdate attribute value in the end date validator. 

I am able to get the value of the attribute in handler, But i could not get value in the validators

"usr.usrenddatevalidator":{

                "validator": function(config){

                    return function(control){

                        var date1 = new Date();

                        var date2 = new Date(control.value);

                        var date3 = startdateAttributeValue;

                        return (date2 < date1 || date3 >= date2) ?  {"usr.usrenddatevalidator": { message: config.message }} : null;

                    };

                },

                "params":[

                    {"name":"message"}

                   ],

                "async":false

            },

Thanks in Advance 

Gargeyi.G

 

Like 1

Like

3 comments

Hello Gargeyi,

 

Unfortunately there is no way to get data from other controls on the page in the context of validator execution triggered on some of the controls on the page. I've asked our core R&D team to add the possibility to operate with other controls values in terms of validator execution. Thank you for helping us in making the app better!

Oleg Drobina,

Thanks Oleg

 

I have the same issue, I saw this issue was from more than one year, I'm working on Creatio v8.1.3. Is still not possible to resolve what Gargeyi Gnanasekhar ask?

 

In my case I need to validate just when some conditions met regarding some data in the page, for example, the type of document is type1 or type2 or type 3.

 

Is there any workaround to accomplish this need?

 

Thanks in advance

Julio.Falcon_Nodos, hello!

I've checked the problem status, and it's in the process of being resolved. Follow the release updates to be the first to see the news.

Show all comments

I created a harmony of data which comes from external web services. For example, I retrieved dataA for ColumnA, dataB for ColumnB, dataC for ColumnC etc. I want to INSERT this data to section object table which section page based on.



How can i bind these things?

Like 0

Like

1 comments

Hello,

 

You can create a business process in which you will fill in the required fields received from the web service.

 

Details on the academy website:

https://academy.creatio.com/docs/user/bpm_tools/process_elements_refere…

Show all comments

I've have attempted this myself but arrived at the conclusion it's not straightforward, I would rather ask than guess.  Two questions:

 

I want to set the enabled flag of a button depending on whether there are records in the detail with a particular flag set:

  1. Which function do I need to override to initialise the button when the detail loads?  (I have configured 'onGridDataLoaded()' but this is called three times before the detail is loaded.)
  2. Which function do I need to override when a user edits a detail record and changes the value of the flag?  ('onDataChanged()' which doesn't seem to be documented seems to do this.)

Thanks in advance,

Like 0

Like

1 comments

Hello Gareth,

 

1) You need to use the "visible" property for the button in case you need to display it or not based on some condition. As an example there is the getToolsVisible method of the UpButton button in the ProjectStructureDetailV2 detail (on the project page).

 

2) onDataChanged is indeed initialized when something is changed in the detail record.

 

Best regards,

Oscar

Show all comments