Need help calling hierarchical copying from front-end

Hi Team,

I'm trying to call hierarchical copying from the front-end of my Creatio application, but I'm having some trouble. I've read in the Creatio documentation that I should use the callService() method, but I'm not sure how to use it correctly.

I saw an example in the documentation that uses the "ProductBankCustomerJourney" package and the "ProductConditionDetailV2" schema, but I can't seem to find these in my application.

Can anyone provide me with some guidance on how to call hierarchical copying from the front-end of my Creatio application? Any help or advice would be greatly appreciated.

Thanks in advance!

Like 0

Like

1 comments

Hello,

 

This package is a part of the bank-sales-bank-customer-journey installation files so probably that's why you cannot find it in your app. It would be easier to get such a demo or onsite installation files and review the logic there. Here are the methods from the ProductConditionDetailV2 schema:

getCopyRecordConfig: function() {
                return {
                    serviceName: "HierarchyDataCopyingService",
                    methodName: "CreateRecordCopy",
                    data: {
                        schemaName: this.entitySchemaName,
                        recordId: this.$ActiveRow
                    },
                    scope: this
                };
            },
...
copyRecordServiceCallback: function(response) {
                response = response || {};
                response = response.CreateRecordCopyResult || {};
                this.hideBodyMask();
                if (!response.success) {
                    var errorMessage = this.extractErrorMessage(response);
                    this.showInformationDialog(errorMessage);
                    return;
                }
                const copiedRecordId = response.recordId;
                this.openCard(configurationEnums.CardStateV2.COPY, this.Terrasoft.GUID_EMPTY, copiedRecordId);
            },
...
validateConditionsDueDateCallback: function(result) {
                if (result.success) {
                    this.callCopyRecordService();
                    return;
                }
                this.showInformationDialog(result.message);
            },
....
copyRecord: function() {
                this.isCanCopyRecord(function(isCan) {
                    if (!isCan) {
                        var denyMessage = this.get("Resources.Strings.RecordRightsErrorMessage");
                        this.showInformationDialog(denyMessage);
                        return;
                    }
                    this.validateConditionsDueDate(this.validateConditionsDueDateCallback, this);
                }, this);
            },
 
....
 
callCopyRecordService: function() {
                this.showBodyMask();
                var config = this.getCopyRecordConfig();
                this.callService(config, this.copyRecordServiceCallback, this);
            },

The chain is: copyRecord -> validateConditionsDueDate -> validateConditionsDueDateCallback -> callCopyRecordService -> getCopyRecordConfig -> copyRecordServiceCallback.

 

To call the service the config is used:

serviceName: "HierarchyDataCopyingService",
					methodName: "CreateRecordCopy",
					data: {
						schemaName: this.entitySchemaName,
						recordId: this.$ActiveRow
					},

and the actual call is performed:

this.callService(config, this.copyRecordServiceCallback, this);

callback function determines what should be done once the service response is received.

Show all comments