Hi community,

I made a custom button in the product in order detail action menu.

In this button onClick event, I called a business process and had to pass the order's id to it.

How do I get the order id from within the product in order detail schema so that I can pass it to the business process?

 

Thank you!

Like 0

Like

2 comments
Best reply

Hi,

 

You can use:

this.get("MasterRecordId")

to get the master record Id value and use it in the click handler method.

Hi Andrew,

1. You can pass OrderProductId to the process and read OrderId from OrderProduct

2. You can call process from OrderProductDetailV2 with such a code:

            runMyBusinessProcessAll: function() {
                ProcessModuleUtilities.executeProcess({
                    "sysProcessName": "UsrMyProcess",
                    "parameters": {
                        "OrderId": this.get("MasterRecordId")
                    }
                });
            },

Hi,

 

You can use:

this.get("MasterRecordId")

to get the master record Id value and use it in the click handler method.

Show all comments

Hi community,

 

I read the article (https://community.creatio.com/questions/add-action-detail) in Creatio community and added a button in the action menu of our order product detail.

But the visibility seems not working. May you help me to adjust the code below? What I

need is to show the button when some detail records are selected, and hide the button otherwise.

 

                     addToolsButtonMenuItems: function(toolsButtonMenu) {

                             this.callParent(arguments);

                             toolsButtonMenu.addItem(this.getButtonMenuSeparator());

                             toolsButtonMenu.addItem(this.getButtonMenuItem({

                               Caption: this.get("Resources.Strings.UsrBtnBatchUpdate"),

                               Click: {"bindTo": "OnButonClick"},

                               Visible: {"bindTo": "IsSelectRecord"}

                             }));

                     },

 

Thanks a lot!

Like 0

Like

2 comments
Best reply

Hi Andrew,

 

Please use the following approach:

methods: {
				addToolsButtonMenuItems: function(toolsButtonMenu) {
					this.callParent(arguments);
					toolsButtonMenu.addItem(this.getButtonMenuSeparator());
					toolsButtonMenu.addItem(this.getButtonMenuItem({
						Caption: {"bindTo": "Resources.Strings.CustomButton"},
						Click: {"bindTo": "onButonClick"},
						Visible: {"bindTo": "getCustomButtonVisible"},
					}));
				},
				getCustomButtonVisible: function() {
					return this.isSingleSelected();
				},
				onButonClick: function() {
					console.log("Clicked!");
				}
			},

there is no IsSelectRecord base attribute that will make the button visible or invisible, thus there are basic methods to make "Edit" or "Copy" buttons enabled\disabled so I've used the logic behind them as an example to make the custom button visible.

Hi Andrew,

 

Please use the following approach:

methods: {
				addToolsButtonMenuItems: function(toolsButtonMenu) {
					this.callParent(arguments);
					toolsButtonMenu.addItem(this.getButtonMenuSeparator());
					toolsButtonMenu.addItem(this.getButtonMenuItem({
						Caption: {"bindTo": "Resources.Strings.CustomButton"},
						Click: {"bindTo": "onButonClick"},
						Visible: {"bindTo": "getCustomButtonVisible"},
					}));
				},
				getCustomButtonVisible: function() {
					return this.isSingleSelected();
				},
				onButonClick: function() {
					console.log("Clicked!");
				}
			},

there is no IsSelectRecord base attribute that will make the button visible or invisible, thus there are basic methods to make "Edit" or "Copy" buttons enabled\disabled so I've used the logic behind them as an example to make the custom button visible.

Oleg Drobina,

Thank you for your guid!. It works for a single detail record selected, like the behavior of "Edit" or "Copy".

What I want is the like the behavior of "Delete", and I found the solution in the academy.

In summary, I just adjusted the code below to approach the behavior like "Delete" action.

 

getCustomButtonVisible: function() {
    var selectedRows = this.get("SelectedRows");
    return selectedRows ? (selectedRows.length > 0) : false;
},

 

Thank you!

Show all comments

I have a button on a detail that I want to use to filter the records in the said detail upon clicking it. The Apply filter option doesn't seem to be there. Quick filters seem to be working for a section but not on a detail. 

 

Anyone knows a possible solution ?

 

Regards,

Abilash

Like 0

Like

2 comments

hi Abilash,

Have you checked by refreshing the page?
Did you debug to see the execution of the Detail button event?

If the execution of the event is successful, then Grid data must be refreshed and published by applying the latest filter data.
(OR)
It is possible to implement the quick filter module following this article https://academy.creatio.com/documents/technic-sdk/7-13/adding-quick-filter-block-section

BR,
Bhoobalan Palanivelu

Hi Bhoobalan Palanivelu,

 

Thanks for your reply.

 

First part of your question, applying the filter on the detail upon clicking the button is the issue for me.  As for the second part, I've tried implementing the quick filter on the detail but to no avail. It's not throwing an error but nor am I getting the required output.

 

Regards,

Abilash.S

 

Show all comments

Hi all,

 

I wanted to add a mini page to add a record to a detail that does not exist as a section. It is created based on a new object. How can we achieve this?

 

Thank you.

Geeviniy

Like 0

Like

1 comments

Hello Geeviniy, 

 

You can add and configure a mini page for the section. In case you have a custom object and there is obviously no oob section created based on such object, you can create such section from your side, configure mini page and further hide this section from the workplace. This way you'll have the mini page for a detail created based on this custom object and section won't bother you as it's not added to any workplace, therefore not available for users from UI.

Adding mini page to the detail without creating a section based on it's object can be achieved only with a help of additional development.

 

We've also registered a corresponding query for our responsible R&D team to consider implementing the requested functionality in the upcoming versions of a system.

Best regards,
Anastasiia

Show all comments

Hi, community.
 

Is there a way to make a "Detail" read-only on mobile?

I need to hide the "Add" and "Delete" buttons in "Detail" according to some rules.

I know that in the web version we can do this with the code below:

 

 

getAddRecordButtonVisible: function() {return false; },          

editCurrentRecord: () => false,

getEditRecordMenuItem: Terrasoft.emptyFn,

getCopyRecordMenuItem: Terrasoft.emptyFn,

getDeleteRecordMenuItem: Terrasoft.emptyFn,

 

 

Thanks,

Tiago Pierine.

Like 0

Like

7 comments

Hi Tiago,

 

There is a getChangeModeOperations method for each page\view\gird controller and is specified in the following manner in the base page controller:

 

	getChangeModes: function() {
		var changeMode = this.getChangeMode();
		return Terrasoft.DataUtils.getChangeModeOperations(changeMode);
	},
 
	/**
	 * Returns change mode operations.
	 * @protected
	 * @return {Object} Change mode operations.
	 */
	getChangeModeOperations: function() {
		return this.getChangeModes();
	},
 
	/**
	 * Returns change mode bit mask.
	 * @protected
	 * @virtual
	 * @return {Number} Change mode bit mask.
	 */
	getChangeMode: function() {
		var detailConfig = this.getDetailConfig();
		var changeMode;
		if (detailConfig) {
			changeMode = detailConfig.changeMode;
		} else {
			changeMode = Terrasoft.sdk.Module.getConfig(this.self.Model).changeMode;
		}
		return Ext.isNumber(changeMode) ? changeMode : Terrasoft.ChangeModes.All;
	},

So you need to create a controller for your page and extend the method in the way like below (it's an example, should be tested and debugged):

 

getChangeModeOperations: function() {
   var detailConfig = this.getDetailConfig();
   if (detailConfig) {
      var parentRecord = detailConfig.parentRecord;
      if (parentRecord.get("IsNonActualEmail") === false) {
         return {
            canCreate: false,
            canUpdate: false,
            canDelete: false
         };
      }
   }
   return this.callParent(arguments);
}

Best regards,

Oscar

Oscar Dylan,

Hi Oscar, thank you very much for the answer, would you have any examples of how to create a controller of this type? The section that I am using on mobile for this case is "Account".

Hi Tiago,

 

Unfortunately we don't have any instructions on this matter, you need to study how base controllers are created and create one for your section.

 

Best regards,

Oscar

Oscar Dylan,

Hi Oscar, 

 

This code below is it only works for standard details?

 

Terrasoft.sdk.Details.setChangeModes("Contact", "ActivityDetailV2StandartDetail", [Terrasoft.ChangeModes.Read]);

 

I am trying to do it work for Embedded Detail but it is not working like the example below:

 

Terrasoft.sdk.Details.setChangeModes("UsrTributRetPortDetail", "UsrSchemad37cf1aeDetailEmbeddedDetail", [Terrasoft.ChangeModes.Read]);

 Terrasoft.sdk.Details.setChangeModes("AccountAddress", "AccountAddressDetailV2EmbeddedDetail", [Terrasoft.ChangeModes.Read]);

 

 

Hi Tiago Martins Pierine, did you find the way to make the control with this functinoality?

 

Oscar can you tell us in what file you find the base code?

Federico Buffa 😀,

Hi Federico, no, I couldn't get this to work.

Show all comments