Question

Show Dialog Box using customization in Creatio Atlas- New UI

Hi Team,

 

Please provide me with an example for how we can display an Information dialog box after we change the value in a lookup and refresh the page automatically after lookup value change.

 

 

Like 0

Like

1 comments

Hi Sarika,

 

Two examples in one: refresh the page in case the account selected in the lookup column on the page has the "167161603" name (the lookup column is a custom one added to the page) and display a popup stating that the page was refreshed:

handlers: /**SCHEMA_HANDLERS*/[
			{
				request: "crt.HandleViewModelAttributeChangeRequest",
				handler: async (request, next) => {
					if (request.attributeName === 'LookupAttribute_upoxk3v' && request.value.displayValue == '167161603') {
						const handlerChain = sdk.HandlerChainService.instance;
							await handlerChain.process({
								type: 'crt.LoadDataRequest',
								$context: request.$context,
								config: {
									loadType: "reload"
								},
								dataSourceName: "PDS"
							});
						Terrasoft.showInformation("Refreshed!", this);
						return next?.handle(request);
					}
				}
			}
		]/**SCHEMA_HANDLERS*/,

LookupAttribute_upoxk3v should be replaced with the attribute name from the attributes property of the viewModelConfig:

viewModelConfig: /**SCHEMA_VIEW_MODEL_CONFIG*/{
			"attributes": {
				"UsrName": {
					"modelConfig": {
						"path": "PDS.UsrName"
					}
				},
				"Id": {
					"modelConfig": {
						"path": "PDS.Id"
					}
				},
				"LookupAttribute_upoxk3v": {
					"modelConfig": {
						"path": "PDS.UsrAccount"
					}
				}
			}
		}/**SCHEMA_VIEW_MODEL_CONFIG*/,

To find out which attribute is needed you need to take a look at the control of the page element in the viewConfigDiff:

{
				"operation": "insert",
				"name": "ComboBox_i6riofn",
				"values": {
					"layoutConfig": {
						"column": 1,
						"row": 1,
						"colSpan": 1,
						"rowSpan": 1
					},
					"type": "crt.ComboBox",
					"loading": false,
					"control": "$LookupAttribute_upoxk3v",
					"label": "$Resources.Strings.LookupAttribute_upoxk3v",
					"labelPosition": "auto",
					"listActions": [],
					"showValueAsLink": true
				},
				"parentName": "LeftAreaContainer",
				"propertyName": "items",
				"index": 0
			},

Also don't forget to add "@creatio/sdk" into the dependencies. 

Show all comments