Время создания
Filters

Hi Creatio Community!
I’m currently working on a custom Angular component (Freedom UI) and ran into an issue I hope someone has already dealt with. I created a custom table component that loads data from a web service — the structure is quite complex with nested records, so I chose to use a service instead of standard object bindings.

I'm receiving the current record ID like this:

@Input()
@CrtInput()
public recordId!: { value: string; displayValue: string };

This is how I set recordId into component

{
	"operation": "insert",
	"name": "CustomTable",
	"values": {
		"recordId": "$UsrContractConditionsGroupDS_UsrContract_c00dfo4",
		"type": "usr.Table"
	},
	"parentName": "ListOfTarrifGroupByPeriod_ExpansionPanel",
	"propertyName": "items",
	"index": 0
},

When I open the page for the first time, everything works fine — the recordId arrives as expected. 

But when I back to section and open this record again, the component throws an error because recordId is undefined, and my table is empty.

I’m calling the service directly in ngOnInit().

Could you please advise on the correct way to store the record ID in the component so that it doesn’t get lost when opening the page a second time?

 

Like 1

Like

2 comments
Best reply

Hello Artem,

 

You can store record ID in the custom attribute and populate its value when the page is opening in the request crt.HandleViewModelInitRequest.

 

viewModelConfigDiff: /**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/[
	{
		"operation": "merge",
		"path": [
			"attributes"
		],
		"values": {
			"RecordId": {}
			...
		}
	}
	...
]
handlers: [
	{
		request: "crt.HandleViewModelInitRequest",
		handler: async (request, next) => {
			await next?.handle(request);
			request.$context.RecordId = request.$context.Id;
		}
	}
]

Then you can use this custom attribute in your component

 

{
	"operation": "insert",
	"name": "CustomTable",
	"values": {
		"recordId": "$RecordId",
		"type": "usr.Table"
	},
	"parentName": "ListOfTarrifGroupByPeriod_ExpansionPanel",
	"propertyName": "items",
	"index": 0
},

Hello Artem,

 

You can store record ID in the custom attribute and populate its value when the page is opening in the request crt.HandleViewModelInitRequest.

 

viewModelConfigDiff: /**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/[
	{
		"operation": "merge",
		"path": [
			"attributes"
		],
		"values": {
			"RecordId": {}
			...
		}
	}
	...
]
handlers: [
	{
		request: "crt.HandleViewModelInitRequest",
		handler: async (request, next) => {
			await next?.handle(request);
			request.$context.RecordId = request.$context.Id;
		}
	}
]

Then you can use this custom attribute in your component

 

{
	"operation": "insert",
	"name": "CustomTable",
	"values": {
		"recordId": "$RecordId",
		"type": "usr.Table"
	},
	"parentName": "ListOfTarrifGroupByPeriod_ExpansionPanel",
	"propertyName": "items",
	"index": 0
},

Iryna Oriyenko,

Thank you very much!

Show all comments

Hello,

 

I am currently generating multiple report templates, some of these templates need to show list components attached to a record. For example, A loan application that has multiple collaterals attached to it or a payment schedule stored in a list component. How do I achieve this?

Like 0

Like

1 comments

'Which records to approve field shows readonly in the Approvals, because of this the Approval component not visible in the page.

Like 0

Like

1 comments

Hello!

Could you please provide details about the idea behind using these fields? This will help us give more specific information on how to work with approvals.

Show all comments
Discussion

Hello. Clio team started new project Clio satelite - plugin for Chrome and Edge browser to improve developer experience. It works without installing packages or modification on environments. Compatible with version 8.+

Fast login


Fast navigations


Fast actions

Do you like it? :)

#clio #cliosatelite #development #creatio

2 comments

When is this expected to be released?

 

Ajay Varghese,

The plugin is currently undergoing internal testing by the Creatio teams. We plan to make it publicly available by the end of this month.

Show all comments

Hello,

I created OAUTH 2.0 credentials in Creatio, But Now when I am trying to delete them I am getting error as below:



I checked if there is any dependency on this credentials by clicking on "View Details" as below:



Can anyone guide me what might be issue here?

Thanks !!

Like 0

Like

1 comments

Hi,

The behavior seems a bit odd, and I wasn’t able to reproduce it. I recommend trying the following steps:

  1. Add the "Errors of multi deleting" lookup and check the logs from the moment you attempted the deletion. Most likely, there’s a foreign key constraint error in the database. Check which table the record is referencing.

    There may be a case where the object was deleted from the system, but a reference to the record remained in the DB. In such a case, you’ll need to either manually delete the related record from the referencing table or nullify the relationship.

  2. Another possible scenario is that the related object was deleted, but the source code generation was not performed. As a result, the system is trying to resolve a link to a deleted object. To analyze this, open the Network tab in Developer Tools before clicking the "View details" button and check if there are any errors in the requests — especially the "GetDependentEntities" request.

In any case, it's best to start with the "Errors of multi deleting" logs and then proceed with analysis based on the result — checking whether the issue lies in a constraint, which object it refers to, whether it still exists, and whether it’s a system object, etc.

Hope this helps!

If these steps don’t help identify the root cause, please contact our support team at support@creatio.com.

Show all comments