Hi 
i have a little problem with new order button on opportunity.
I want this button was visible only when stage of opportunity is Closed Won stage
i've changed in BP adding filter. Maybe it's something with package ? When I add this filter current package changed and i can't save as OrderInSales the proper package. Even I change current package on custon this is not working.

 

Like 0

Like

2 comments

Hello,

 

Please note that there is no option to hide the button with a business process.

Hi

So there is no option to make button "Add New order" stay hidden until the opportunity stage change on Closed Won?

Show all comments
Question

Hello, community!

 

Is there any way that I can customize the appearance of the task? So, instead of it being with a single button - "completed" could I remove this "completed" button and add two more of my own? Something like this:

Like 0

Like

3 comments

Hi Nicolaiciuc Maria,

Do you want to customize this task in the dashboard?
i.e the tasks appear in the section dashboard area.

BR,
Bhoobalan Palanivelu.

Bhoobalan Palanivelu,

I am not sure what do you mean by dashboard. I want these buttons right in the section page of the record, where the tasks usually apear. I will attach a photo for you. Thank you!

Nicolaiciuc Maria,

Thanks for clarifying!

 

To change the view of the task (modify the buttons) in the action dashboard (the place where you want as attached in your screenshot) you can do the following: 

 

STEP 1: Create your own module extending "BaseDashboardItemViewConfig" and changing the Item view as you need. You can see how the fields are displayed in the getActionsViewConfig() method, which you would need to modify. 

define("UsrDashboardItemViewConfig", ["BaseDashboardItemViewConfig"], function() {
    Ext.define("Terrasoft.configuration.UsrDashboardItemViewConfig", {
        extend: "Terrasoft.BaseDashboardItemViewConfig",
        alternateClassName: "Terrasoft.UsrDashboardItemViewConfig",
 
        getActionsViewConfig: function() {
            return {
                "name": "Actions",
                "itemType": Terrasoft.ViewItemType.CONTAINER,
                "classes": {wrapClassName: ["dashboard-item-actions on-hover-visible"]},
                "items": [
                    {
                        "name": "NO",
                        "itemType": Terrasoft.ViewItemType.BUTTON,
                        "style": Terrasoft.controls.ButtonEnums.style.BLUE,
                        "caption": "No",
                        "click": {"bindTo": "onCancelButtonClick"},
                        "classes": {
                            "textClass": "dashboard-item-right"
                        },
                        "visible": {"bindTo": "CancelButtonVisible"}
                    },
                    {
                        "name": "YES",
                        "itemType": Terrasoft.ViewItemType.BUTTON,
                        "style": Terrasoft.controls.ButtonEnums.style.BLUE,
                        "caption": "Yes",
                        "click": {"bindTo": "onExecuteButtonClick"},
                        "classes": {
                            "textClass": "dashboard-item-right"
                        },
                        "visible": {"bindTo": "ExecuteButtonVisible"}
                    },
 
                ]
            };
        }
    });
});

STEP 2: Create a replacing SectionActionsDashboard schema and add your modules to the dependencies. 
 

define("SectionActionsDashboard", ["UsrDashboardItemViewConfig"], function() {
    return {
 
        methods: {
            initDashboardConfig: function() {
                this.callParent(arguments);
                const dashboardConfig = this.get("DashboardConfig");
                var activityItemsConfig = {
                    "Activity": {
                        viewModelClassName: "Terrasoft.ActivityDashboardItemViewModel",
                        viewConfigClassName: "Terrasoft.BaseDashboardItemViewConfig"
                    }
                };
                if (this.$entitySchemaName === "Case") {
                    activityItemsConfig.Activity.viewConfigClassName = "Terrasoft.UsrDashboardItemViewConfig";
                }
                Ext.merge(dashboardConfig, activityItemsConfig);
                this.set("DashboardConfig", dashboardConfig);
            }
        }
    };
});

 

 

BR,
Bhoobalan Palanivelu.

 

 

Show all comments

I need the button that I created "Adjust Inventory" to be visible only when the page is not with altered fields without having the values saved.

So when it is unsaved it will show like this:

And when you have the "Save" and "Cancel" buttons visible, it should be disabled.

Like 0

Like

3 comments

Hi Gabriel,

Can you please check the SchemaPageV2 of your object?
That should have the Button definition in the Diff array and you can add the Visible: false property to it to remove it from your edit page.

BR,
Bhoobalan Palanivelu.
 

Bhoobalan Palanivelu,

I created an attribute to be able to disable it when there is an unsaved field, the problem is that I can't change it, and the page in the two images above are the same page, it is a detail page.

 

Gabriel Cassimiro,

 

Could you please share with us more details on the page/detail where you are using this, and the current code implementation that you have for your button?

 

Best regards,

Dariy

Show all comments

Hello, community!

This is a selection window for my lookup. Lets take this example, I should not be able to select collaterals that have remaining allocation 0. My problem is that this field is being populated by a process, and the regular lookup filtration does not work. Is there any way to make that select button throw an error/ not let the user save their pick? As in, if remaining allocation equals 0 => select button will do nothing.

Like 0

Like

1 comments

Hello Maria,

Modifying this module window is quite a hard task to do. I believe is your case attribute filter will work just fine:

attributes: {
			"{Your lookup column Name}": {
                "dataValueType": Terrasoft.DataValueType.LOOKUP,
                "lookupListConfig": {
                    "filters": [
                        function() {
                            var filterGroup = Ext.create("Terrasoft.FilterGroup");
                            filterGroup.add("IsNotNull",
                                Terrasoft.createColumnFilterWithParameter(
                                    Terrasoft.ComparisonType.GREATER,
                                    "[{Your lookup column Name}:Id].RemainingAllocation", 0));
                            return filterGroup;
                        }
                    ]
                }
            }
		},

With these records where the remaining allocation is 0 will not be displayed.

Show all comments

Hello,

 

I am willing to change publish button caption. any ideas how can we do this? I tried to override the module but in vain.

 

Like 0

Like

1 comments

Hello,

If you want to change the caption of the publish button then you need to create a replacing schema of BaseMessagePublisherPage and in it change the value of the PublishButtonCaption localizable string

 

Show all comments

Hello,

I would like create multiple buttons that call a business process. Due to the number of buttons in my page, I would like to create a single button click method. This method would receive a parameter that would tell it which button was called. The parameter would then determine which field would be read.

My button method should look something like this:

 onButtonClick: function(clickedButton){
				var recordId = this.get("Id");
                var readField = "Error"; //This value should change later, will show error otherwise
 
                switch(clickedButton){
                    case "Button1":
                        readField = this.get("Field1");
                        break;
                    case "Button2":
                        readField = this.get("Field2");
                        break;
                    /*More Cases
                    .
                    .
                    .
                    */
                   default:
                    console.log(readField);
                    break;
                }
 
                var config = {
                    sysProcessName: "UsrBpToCall",
                	parameters: {
						CurrentRecordId: recordId,
						ReadField: readField,
 
					}
				};
                ProcessModuleUtilities.executeProcess(config);
}

I assume the parameter would appear in the diff section, but I do not know how to implement this functionality.

I appreciate your help!

 

Kind Regards,
Firas

 

Like 1

Like

3 comments
Best reply

Hello Firas,

If you add a tag to each button it will get passed as the fourth parameter to the click handler. 

For example:

{
	"operation": "insert",
	"parentName": "Detail",
	"propertyName": "tools",
	"name": "MyButton1",
	"values": {
		"itemType": Terrasoft.ViewItemType.BUTTON,
		"caption": "Send selected invoice",
		"click": {"bindTo": "onMyButtonClick"},
		"tag": "MyButton1"
	}
}

Then you can retrieve the tag in the click function handler like this: 

onMyButtonClick: function(p1, p2, p3, tag) {
    console.log(tag);
}

Ryan

Hello Firas,

If you add a tag to each button it will get passed as the fourth parameter to the click handler. 

For example:

{
	"operation": "insert",
	"parentName": "Detail",
	"propertyName": "tools",
	"name": "MyButton1",
	"values": {
		"itemType": Terrasoft.ViewItemType.BUTTON,
		"caption": "Send selected invoice",
		"click": {"bindTo": "onMyButtonClick"},
		"tag": "MyButton1"
	}
}

Then you can retrieve the tag in the click function handler like this: 

onMyButtonClick: function(p1, p2, p3, tag) {
    console.log(tag);
}

Ryan

Ryan Farley,

the solution works perfectly. Thank you.

I have a follow-up question if you do not mind. Does the tag being passed as the fourth argument mean that button click methods can take up to 4 arguments?  If that is the case how can one proceed if they were to pass more than one argument and populate p1 through p3? 

Thank you again, your Community responses and articles have been very helpful.

Firas

Hello,

 

Not sure about passing 4 arguments to the click event, I've been using the tag property only to pass the parameter needed. In your case you can bind the click-handler method to several buttons and specify different tags for it so the click-handler method could understand what to do according to the button tag.

Show all comments

Can I add custom function on this search button? Like alert or console

Like 0

Like

1 comments

Hello,

 

Theoretically, this is possible through additional development. 
 

This modal window is a separate schema called "LookupPage". The logic that is responsible for searching is located in the "LookupPageViewModelGenerator" schema

Unfortunately, we don't have the ready example of such realisation.

Best regards,
Bogdan

Show all comments

Hi Everyone,

I need to Hide button based on organizational role. I've used the following code but am not able to achieve the objective.

 

attributes:{
             "IsUserX": {
                    dataValueType: Terrasoft.DataValueType.BOOLEAN,
                    type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
                    value: true
                },
        },

        onEntityInitialized: function() {
                    // Calling the parent implementation of the onEntityInitialized method.
                    this.callParent(arguments);
                    this.fnIsUserX();

            },
            getSectionActions:function(){
                var actionMenuItems = this.callParent(arguments);
                actionMenuItems.addItem(this.getButtonMenuItem({
                    Type:"Terrasoft.MenuSeparator",
                    Caption:""
                }));
                //actionMenuItems.addItem(this.getButtonMenuSeparator());
                actionMenuItems.addItem(this.getButtonMenuItem({
                                        "Tag":"XYZ",
                                        "Caption":"XYZ",
                                        "Click":{"bindTo":"ABC"},
                                        "Visible": {"bindTo": "IsUserX"},
                                        "Enabled": {"bindTo": "isCustomActionEnabled"},
                                        }));
                return actionMenuItems;
            },
            isCustomActionEnabled: function() {
                var selectedRows = this.get("SelectedRows");
                console.log(selectedRows);
                return selectedRows ? (selectedRows.length > 0 && selectedRows.length <= 50) : false;
            },
            fnIsUserX:function(){
                var currentuser = Terrasoft.SysValue.CURRENT_USER.value;
                var esqAdmin = this.Ext.create("Terrasoft.EntitySchemaQuery", {
                    rootSchemaName: "SysUserInRole"
                });
                esqAdmin.addColumn("SysRole");
                esqAdmin.addColumn("SysUser");
                var grpFilters = this.Ext.create("Terrasoft.FilterGroup");
                var filterUser = this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "SysUser", currentuser);
                var filterRole = this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "SysRole.Name", "XYZ");
                grpFilters.addItem(filterUser);
                grpFilters.logicalOperation = this.Terrasoft.LogicalOperatorType.AND;
                grpFilters.addItem(filterRole);
                esqAdmin.filters.add(grpFilters);
                esqAdmin.getEntityCollection(function(result) {
                    if (!result.success) {
                        this.set("IsUserX",false);
                        return;
                    }
                    else {
                        var length = result.collection.collection.length;
                        if (length>0){
                            this.set("IsUserX", true);
                        }
                    }
                }, this);
            },

Like 0

Like

1 comments

Hi,

 

There is no onEntityInitialized method in the section page (it's available in the edit page only). If you need the button to be visible based on the user role you need to set the value for the "Visible" attribute in the button config (inside the actionMenuItems.addItem this.getButtonMenuItem function). You can use the example of the "Change log" button from the BaseDataView module (start seeking an example using this part of code - actionMenuItems.addItem(this.getObjectChangeLogSettingsMenuItem());) where operation permission is checked to display the button (and operation permissions are assigned to roles and this is what is needed in your task).

 

Best regards,

Oscar

Show all comments

I am going to add custom button which alerts some text on contact page. Is it possible?

Like 0

Like

2 comments

Hello Muhammadjon,

 

in order to achieve this you need to create a Replacing view model at the Custom package.

For the partent object you will need to select ContactSectionV2, or the section where you want to create this button.

Then you need to create a new localizable string (you will see the possibility to create a new one on the left) where you will put the desired text. for the button. While creating the localizable string you will need to enter the value, and the code. The code is something that you will use later.

 

After that you insert this code on the page:

 define("ContactSectionV2",
        function(BaseFiltersGenerateModule, Enums, ConfigurationConstants, BusinessRuleModule) {
            return {
                entitySchemaName: "Contact",
                messages: {},
                attributes: {},
                rules: {}/**SCHEMA_MODULES*/,
                /**
                 * Current schema mixins
                 */
                mixins: {},
                methods: {
                    OnTestButtonClick : function() {
                        Terrasoft.showInformation('Test') 
                    }
                },
                diff: /**SCHEMA_DIFF*/[
                    {
                    "operation": "insert",
                    "parentName": "ActionButtonsContainer",
                    "propertyName": "items",
                    "name": "TestButton",
                    "values": {
                        "itemType": Terrasoft.ViewItemType.BUTTON,
                        "style": Terrasoft.controls.ButtonEnums.style.GREEN,
                        "caption": {"bindTo": "Resources.Strings.TestButtonCaption"},
                        "markerValue": {"bindTo": "QualificationProcessButtonCaption"},
                        "classes": {"wrapperClass": ["t-btn-wrapper t-btn-text t-btn-style-blue actions-button-margin-right"]},
                        "iconAlign": Terrasoft.controls.ButtonEnums.iconAlign.RIGHT,
                        "click": {"bindTo": "OnTestButtonClick"},
                        "layout": {
                            "column": 6,
                            "row": 0,
                            "colSpan": 2
                        },
                        "visible": true
                    }
                }    ]/**SCHEMA_DIFF*/
            };
        });

 

The method  Terrasoft.showInformation('Test')  is the one responsible for displaying the message on screen. Here instead of Test you can write any message. 

The part where it says "caption": {"bindTo": "Resources.Strings.TestButtonCaption"}" , this is where you put the code from the localizable string previously created. So if the code of the string was called TestButtonCaption, then you need to put Resources.Strings.TestButtonCaption. If you name the code like "RandomButton" then it will be Resources.Strings.RandomButton.

 

Best regards,

Dariy 

Thanks so much! This is so helpful

Dariy Pavlyk,

Show all comments

How can i create custom button which alerts some text?

Like 0

Like

1 comments

Hello Muhammadjon,

 

in order to achieve this you need to create a Replacing view model at the Custom package.

For the partent object you will need to select ContactSectionV2, or the section where you want to create this button.

Then you need to create a new localizable string (you will see the possibility to create a new one on the left) where you will put the desired text. for the button. While creating the localizable string you will need to enter the value, and the code. The code is something that you will use later.

 

After that you insert this code on the page:

 define("ContactSectionV2",
        function(BaseFiltersGenerateModule, Enums, ConfigurationConstants, BusinessRuleModule) {
            return {
                entitySchemaName: "Contact",
                messages: {},
                attributes: {},
                rules: {}/**SCHEMA_MODULES*/,
                /**
                 * Current schema mixins
                 */
                mixins: {},
                methods: {
                    OnTestButtonClick : function() {
                        Terrasoft.showInformation('Test') 
                    }
                },
                diff: /**SCHEMA_DIFF*/[
                    {
                    "operation": "insert",
                    "parentName": "ActionButtonsContainer",
                    "propertyName": "items",
                    "name": "TestButton",
                    "values": {
                        "itemType": Terrasoft.ViewItemType.BUTTON,
                        "style": Terrasoft.controls.ButtonEnums.style.GREEN,
                        "caption": {"bindTo": "Resources.Strings.TestButtonCaption"},
                        "markerValue": {"bindTo": "QualificationProcessButtonCaption"},
                        "classes": {"wrapperClass": ["t-btn-wrapper t-btn-text t-btn-style-blue actions-button-margin-right"]},
                        "iconAlign": Terrasoft.controls.ButtonEnums.iconAlign.RIGHT,
                        "click": {"bindTo": "OnTestButtonClick"},
                        "layout": {
                            "column": 6,
                            "row": 0,
                            "colSpan": 2
                        },
                        "visible": true
                    }
                }    ]/**SCHEMA_DIFF*/
            };
        });

 

The method  Terrasoft.showInformation('Test')  is the one responsible for displaying the message on screen. Here instead of Test you can write any message. 

The part where it says "caption": {"bindTo": "Resources.Strings.TestButtonCaption"}" , this is where you put the code from the localizable string previously created. So if the code of the string was called TestButtonCaption, then you need to put Resources.Strings.TestButtonCaption. If you name the code like "RandomButton" then it will be Resources.Strings.RandomButton.

 

Best regards,

Dariy 

Show all comments