Hi community,

 

I try to trigger a business process from a custom button. I in the post that I need the ProcessModuleUtilities to achieve that. Here is my code :

 

define("MTF_Candidat1Page", ["MultiChoiceMixin", "ProcessModuleUtilities"], function(ProcessModuleUtilities) { 
	return {
		entitySchemaName: "MTF_Candidat",
		...
		methods: {
			OnClickCreateInterview: function(){
				var args = {
					sysProcessName: "MTFtestbtn" // this is the name of my business process. It simply send me a mail for now.
				};
				ProcessModuleUtilities.executeProcess(args);
 
				this.showInformationDialog("Busniess process triggered"); // just to show something to let me know the function triggered properly the busniess process
			},
		},
		...
		diff: /**SCHEMA_DIFF*/[
				...
				{
				"operation": "insert",
				"name": "BtnCreateInterview",
				"values": {
					"layout": {
						"colSpan": 24,
						"rowSpan": 1,
						"column": 0,
						"row": 7
					},
					"itemType": 5,
					"classes": {
						"textClass": [
							"actions-button-margin-right"
						],
						"wrapperClass": [
							"actions-button-margin-right"
						]
					},
					"click": {
						"bindTo": "OnClickCreateInterview"
					},
					"tag": "OnClickCreateInterview",
					"caption": {
						"bindTo": "Resources.Strings.BtnCreateInterviewCaption"
					},
					"hint": {
						"bindTo": "Resources.Strings.BtnCreateInterviewHint"
					}
				},
				"parentName": "ProfileContainer",
				"propertyName": "items",
				"index": 7
			}
			...
		]/**SCHEMA_DIFF*/
}

 

Now when I click on the button on my candidate page I have this error :

 

"Uncaught TypeError: ProcessModuleUtilities is undefined"

 

Do you have other docs to trigger business processes on custom button press ?

 

Best regards,

 

Julien

Like 0

Like

2 comments
Best reply

Hi Julien,

 

Could you change your schema definition as the following (swap "MultiChoiceMixin" and "ProcessModuleUtilities")?

define("MTF_Candidat1Page", ["ProcessModuleUtilities", "MultiChoiceMixin"], function(ProcessModuleUtilities) 

regards,

 

Cheng Gong

Hi Julien,

 

Could you change your schema definition as the following (swap "MultiChoiceMixin" and "ProcessModuleUtilities")?

define("MTF_Candidat1Page", ["ProcessModuleUtilities", "MultiChoiceMixin"], function(ProcessModuleUtilities) 

regards,

 

Cheng Gong

Cheng Gong,

 It works, thank you !

Show all comments

In a section edit page, we have created custom buttons and have functionalities to hide and show the button. If we refresh the page Button enable/ Disable are working fine

But once we open the edit page, the button visibily/ page opening are not working properly until we refresh the page

we tried  this.reloadEntity(); inside init:function(){} Method.

 

Please Suggest me how to solve this issue.

 

Like 0

Like

3 comments

Dear Mansoor,
 

Could you please create a case for our technical support indicating the issue and providing external access to the instance?

Thank you in advance,

Ivanna.

Ivanna Yatsura,

Dear Ivanna,

 

Yes I created the request for Creatio team (Request Id is:  #SR-01039215) 

Dear Ivanna,

 

Is there any update on this issue.

 

Thank you in advance,

Mansoor 

Show all comments

Hi,

I'm working on Activities right now and I created my own activity.
I wanted to insert a New Activity with a press of a button which is located in the MainHeader. Question, what's the best way to insert my own activity?

I am currently trying to insert it via custom web service through

Insert insert = new Insert(UserConnection)
                .Set("","")
                .Into("Activity")

I'm afraid there are events, computations that won't be triggered.

Any comments?

Like 0

Like

4 comments
Best reply

Solem Khan Abdusalam,

After you call activity.Save() you can get the created record Id using 

// get primary Id value
var id = activity.PrimaryColumnValue;
// or get any of the column values using 
var title = activity.GetTypedColumnValue<string>("Title");
var start = activity.GetTypedColumnValue<DateTime>("StartDate");
// etc

Ryan

Using the Insert class does not trigger process events, etc. Instead, you can use the Entity class. Something like this: 

var schema = UserConnection.EntitySchemaManager.GetInstanceByName("Activity");
// Create a new Activity object
var activity = schema.CreateEntity(UserConnection);
// Set any any default column values 
activity.SetDefColumnValues();
// Now set the column values as needed
activity.SetColumnValue("Title", "This is a new activity");
activity.SetColumnValue("StartDate", DateTime.Now);
// etc
// Save when done
activity.Save();

Hope this helps.

Ryan

Ryan Farley,

Is there a way to fetch the Id of the created Activity?

Solem Khan Abdusalam,

 

One of possible ways is to create a SELECT query to the database using or the script task process element (if you are going to use a business process) or in the custom web service that is triggered upon clicking the button and select the last created activity (top 1 and ORDER BY CreatedOn conditions). Also the created activity can have some marker in its subject (like "created via web service" or so) that could be used in the filtering condition as well.

 

Insert query you've proposed won't return an Id of the record, but you can select it once the record is created.

 

Best regards,

Oscar

Solem Khan Abdusalam,

After you call activity.Save() you can get the created record Id using 

// get primary Id value
var id = activity.PrimaryColumnValue;
// or get any of the column values using 
var title = activity.GetTypedColumnValue<string>("Title");
var start = activity.GetTypedColumnValue<DateTime>("StartDate");
// etc

Ryan

Show all comments

We need to add a custom button to the section analytical view page, which will trigger a business process.

 

 

Is it possible ?

Like 0

Like

3 comments

 This container you are referring to is supposed to store DataViews in it (please take a look at the getDefaultDataViews method from the BaseDataView module). It is not supposed to store buttons in it.

 

It is better to add the button to a separate container created in the FiltersContainer container and bind process execution to this button. As an example I've added the button to the contact section analytics data view:

define("ContactSectionV2", ["ProcessModuleUtilities"],
	function(ProcessModuleUtilities) {
		return {
			entitySchemaName: "Contact",
			attributes: {},
			messages: {},
			methods: {
				runCustomProcess: function() {
					var config = {
						sysProcessName: "UsrProcess_eedcaa6"
					};
					ProcessModuleUtilities.executeProcess(config);
				}
			},
			diff: /**SCHEMA_DIFF*/ [
				{
					"operation": "insert",
					"name": "CustomButtonContainer",
					"parentName": "FiltersContainer",
					"propertyName": "items",
					"values": {
						"itemType": Terrasoft.ViewItemType.CONTAINER,
						"items": []
 
				},
				{
					"operation":"insert",
					"name": "TestProcessButton",
					"parentName": "CustomButtonContainer",
					"propertyName": "items",
					"values": {
						"itemType": Terrasoft.ViewItemType.BUTTON,
						"caption": {bindTo: "Resources.Strings.CustomButtonCaption"},
						"click": {bindTo: "runCustomProcess"},
						"style": Terrasoft.controls.ButtonEnums.style.GREEN
					}
				}
				] /**SCHEMA_DIFF*/
		};
	});

And connected custom process execution when clicking the button. As a result the button appeared on the page as expected:

And a custom process was executed upon clicking it.

 

Best regards,

Oscar

Oleg Drobina,

Hi Oleg

 

Couple of questions. If I just wanted this button to appear on List View of the Section Page rather than the Analytics what would need to change?

 

Also does this code create the custom button here or does that need to be created elsewhere and it is just referenced here?

 

thanks

Rob Watson,

 

Hello Rob,

 

For the first question: I used the FiltersContainer container as a parent for the button, but it has the logic that it's hidden in the list view and is displayed only in analytics view (logic of the saveFiltersContainersVisibility method). In this case logic like this should be used:

methods: {
...
loadAnalyticsDataView: function() {
					this.set("IsCustomButtonContainerVisible", false);
					this.callParent(arguments);
				},
 
				loadGridDataView: function() {
					this.set("IsCustomButtonContainerVisible", true);
					this.callParent(arguments);
				},
...
 
diff: [
...
{
					"operation": "insert",
					"name": "CustomButtonContainer",
					"parentName": "QuickFilterModuleContainer",
					"propertyName": "items",
					"values": {
						"itemType": Terrasoft.ViewItemType.CONTAINER,
						"visible": { "bindTo": "IsCustomButtonContainerVisible" },
						"items": []
					}
				},
				{
					"operation":"insert",
					"name": "TestProcessButton",
					"parentName": "CustomButtonContainer",
					"propertyName": "items",
					"values": {
						"itemType": Terrasoft.ViewItemType.BUTTON,
						"caption": {bindTo: "Resources.Strings.CustomButtonCaption"},
						"click": {bindTo: "runCustomProcess"},
						"style": Terrasoft.controls.ButtonEnums.style.GREEN
					}
				}
...
]

We change a parent item for the "CustomButtonContainer" to "QuickFilterModuleContainer". As a result button will be visible only in list view and will be hidden in analytics view.

 

As for the second quesion: the button is created in the schema diff directly (container + button itself).

Show all comments

After custom section button processing in list view mode, I need to switch to analytics view, instead of returning and waiting for the user to click on the analytics view button.

Is it possible ?

Like 0

Like

4 comments
Best reply

Ricardo Bigio,

You can use the following code to change to the dashboard view in a section:

this.changeDataView(this.get("AnalyticsDataViewName"));

Ryan

Hello Ricardo,

 

Can you please provide us with more details regarding your request and the business task you are trying to achieve?

I suppose you have some custom section with records and after you open a record and click some button on the page, you want the system to open section Dashboards instead of the regular section record list, am I correct?

 

Thank you!

 

Best regards,

Bogdan S.

On the section page are the buttons "new", "actions" , and the ones that switch from list mode to analytic mode.

Besides them,  I have a custom button,  "I/S",  that triggers a business process (in order to build data that will be shown when the user switches to analytic mode) and returns to the section page. Upon return, the section page will be in list mode, as it was before. What I need is the code in the section button processing to return to the section page already in analytic mode, so that the user will not have to click on the analytic mode icon in order to view the data.

 

Ricardo Bigio,

You can use the following code to change to the dashboard view in a section:

this.changeDataView(this.get("AnalyticsDataViewName"));

Ryan

Perfect. Thanks !

Show all comments

Hello all,

 

I am working on modifying the Search contact and accounts page to add a cancel button to the top of the page so that the user can exit the page and properly terminate the business process that opens it.

However, I've added the script for inserting a button but it won't show up on the page. Here is my script below. Is there something I could be doing wrong?

Like 0

Like

3 comments

Dear Kevin,

 

Could you please provide us with the information about how this page was created and how this page is called in a business process?

 

If this page is a pre-configured page, so you can easily add a button using page wizard and bind the “click” attribute to the appropriate method through a development.

 

 Best regards,

Norton

Norton Lingard,

It is the "Search page - Contacts and Accoutns" page that is used in the Identify contact by incoming call process. 

 

It is called like a pre-configured page in the process but when I try to modify it, it only opens right to the schema code instead of opening the page wizard. 

Dear Kevin,

 

I created the replacing client module for the “SearchAccountAndContactPage” schema and added the following code:

 

define("SearchAccountAndContactPage", [], function(){
    return {
        entitySchemaName: "Case",
        methods: {
            onCloseContactButton: function() {
                // business logic;
                alert("onCloseContactButton.click()");
            }
        },
        diff: [
                    {
                        "operation": "insert",
                        "parentName": "LeftContainer",
                        "propertyName": "items",
                        "name": "ClosePageButton",
                        "values": {
                            "itemType": this.Terrasoft.ViewItemType.BUTTON,
                            "caption": {"bindTo": "Resources.Strings.ClosePageButtonCaption"},
                            "click": {"bindTo": "onCloseContactButton"},
                            "style": "red"
                        }
                    }            
            ]
    };    
});

 

 

As a result, the button has successfully appeared in the page. Please see the screenshot below:

 

 

Please check you entered the correct value for the “caption” property. Since if this property has the wrong value, the button won’t be visible in the page.

 

Best regards,

Norton

Show all comments

Dear community,

 

How to add a custom button (to start the process for this activity) to the action dashboard for only one section (for ex. Case)?

 

Thanks 

Regards

Like 0

Like

7 comments

Dear Mariia,

 

You need to create a module and Extend BaseDashboardItemViewConfig cancel button. Here is the button code example:

 

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": "Cancel",
                        "itemType": Terrasoft.ViewItemType.BUTTON,
                        "style": Terrasoft.controls.ButtonEnums.style.BLUE,
                        "caption": {"bindTo": "CancelButtonCaption"},
                        "click": {"bindTo": "onCancelButtonClick"},
                        "classes": {
                            "textClass": "dashboard-item-right"
                        },
                        "visible": {"bindTo": "CancelButtonVisible"}
                    },
                    {
                        "name": "Cancel2",
                        "itemType": Terrasoft.ViewItemType.BUTTON,
                        "style": Terrasoft.controls.ButtonEnums.style.BLUE,
                        "caption": "TEST",
                        "click": {"bindTo": "onCancelButtonClick"},
                        "classes": {
                            "textClass": "dashboard-item-right"
                        },
                        "visible": {"bindTo": "ExecuteButtonVisible"}
                    },
                    {
                        "name": "Execute",
                        "itemType": Terrasoft.ViewItemType.BUTTON,
                        "style": Terrasoft.controls.ButtonEnums.style.GREEN,
                        "caption": {"bindTo": "ExecuteButtonCaption"},
                        "click": {"bindTo": "onExecuteButtonClick"},
                        "classes": {
                            "textClass": "dashboard-item-right"
                        },
                        "visible": {"bindTo": "ExecuteButtonVisible"}
                    }
                ]
            };
        }
    });
});

Create replacing client module of SectionActionsDashboard

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);
            }
        }
    };
});

 

Regards,

Dean

Dean Parrett,

 

Thank you for your answer.
I have one more question about this:
How to add another custom "UsrDescription" column to the action dashboard ?

I tried to overload the method

 

/**
             * @inheritdoc Terrasoft.EntityDashboardItemViewModel#addQueryColumns
             * @overridden
             */
            addQueryColumns: function(esq) {
                this.callParent(arguments);
                esq.addColumn("Title", "Caption");
                esq.addColumn("Type");
                esq.addColumn("StartDate", "Date");
                esq.addColumn("Owner.Name", "Owner");
                esq.addColumn("ProcessElementId");
                esq.addColumn("UsrDescription", "Description");
            },

but it didn't work.

 

 

Thank you in advance for your answer.

 

Best regards,

Mariia

Mariia Prostiak,

 

The columns in the action dashboard are columns of activity so you need to add it on activity object first. To add it on the activity card on the action dashboard please see the community article below:

https://community.creatio.com/questions/change-task-displayed-fields

 

Best regards, 

Dennis 

Dean Parrett,

 

Can you please help me with the Model Part (ActivityDashboardItemViewModel) of the code where I have to Link the button to a business process??

Thank You in Advance,

Venkatesh

Venkatesh Sundaram,

 

Hello!

Could you please explain your issue in more detail?

 

Best regards,

Max.

Max,

 

Hello!

To make the Attached button in the Activity Element Function, i.e., For Example- If the attached button is a Cancel Button which on click should direct to another stage(Canceled) in the DCM Cycle.

Attached a Image for my request. Help me in this.

Thanks,

Venkatesh.

 

Venkatesh Sundaram,

 

If this activity is created by the DCM and the button sets the activity's status to "Canceled", you can just go into the DCM setup and set it to go to the "Canceled" stage if the activity's status is "Canceled":

 

Best regards,
Max.

Show all comments

Hi Community,

Using below link we can add custom button on CRM section/edit page and specify our own logic like for example we will execute a business process after clicking this button

https://academy.bpmonline.com/documents/technic-sdk/7-12/adding-button-edit-page?_ga=2.110315717.1903804624.1571140505-682725158.1571140505

 

Any idea how we can achieve it in mobile example, I need to show custom button in section/edit page then on click i will execute a business process?

 

Thanks

 

 

Like 0

Like

3 comments

The functionality can be implemented through development.

In order to add a button to the mobile application please follow the instructions from the article by the link below:

https://community.bpmonline.com/articles/adding-custom-user-action-mobile-application

The business process is run on the server side. It's possible to run it from the mobile application by calling the web service. The ProcessEngineService.svc service allows the external application to run business process in the bpm'online. Please find more information about using the web service in the article on Academy:  https://academy.bpmonline.com/documents/technic-sdk/7-14/processengineservicesvc-web-service

Also please check the article about how to call the web service in the Mobile App. It will be helpful for your purposes. 

https://community.bpmonline.com/articles/calling-web-service-mobile-app

Alina Kazmirchuk,

Thanks Alina,

Any idea how can i put a custom button on section page?

 

Fulgen Ninofranco,

Unfortunately, there is no way to add a button on a section page in the mobile application.

Show all comments

Hi all,

        I inserted a custom button in a section

diff: /**SCHEMA_DIFF*/[
            // Metadata for adding a cutom button to the page.
            {
                // Indicates that an operation of adding an item to the page is being executed.
                "operation": "insert",
                // Meta-name of the parent control item where the button is added.
                "parentName": "CombinedModeActionButtonsCardLeftContainer",
                // Indicates that the button is added to the control items collection
                // of the parent item (which name is specified in the parentName).
                "propertyName": "items",
                // Meta-name of the added button. .
                "name": "MainContactButton",
                // Supplementary properties of the item.
                "values": {
                    // Type of the added item is button.
                    itemType: Terrasoft.ViewItemType.BUTTON,
                    // Binding the button title to a localizable string of the schema.
                    caption: {bindTo: "getSendButtonCaption"},
                    // Binding the button press handler method.
                    click: {bindTo: "onSendClick"},
                    // Binding the property of the button availability.
                    enabled: {bindTo: "canSend"},
                    visible: {bindTo: "showButtonSend"},
                    style: Terrasoft.controls.ButtonEnums.style.GREEN,
                    // Setting the field location.
                    "layout": {
                        "column": 1,
                        "row": 6,
                        "colSpan": 1
                    }
                }
            }
        ]

I have bind its caption with a function "getSendButtonCaption", but it doesn't work when I changed value

getSendButtonCaption: function() {
                var activeRow = this.get("ActiveRow");
                if (activeRow) {
                    var sendTime = this.get("GridData").get(activeRow).get("UsrSendTime");
                    if (sendTime) {
                        if (sendTime.value.toUpperCase() === "FC73B30F-9E29-48BA-8A9E-3C4247CFF22A") {
                            return this.get("Resources.Strings.SendManuallyButtonCaption");    
                        } else if (sendTime.value.toUpperCase() === "47AB118D-84C9-4846-B916-8DC40CF0B333") {
                            return this.get("Resources.Strings.ScheduleSendButtonCaption");
                        }
                    }
                }
                return "";
            }

This solution works well in page.Why?

Thanks

Like 0

Like

7 comments

Eugene Podkovka,

Hi Eugene,

          I had read this document before. In that case, the button's caption has bound with resource and doesn't change anymore, but I want to change its caption by changing the value of dropdownlist like the button "Send" in the section "Marketing\Email".

Thanks

Toan Mai,

The button should be added both to the page and to the section. You only added it to the section.

Eugene Podkovka,

I have implemented in section and page. As I said in my question, it only works  in page.

Toan Mai,

No. The code that you added to the post does not contain the part that exists on a page. 

Eugene Podkovka,

Hi Eugene,

         Please send me your email, I will send you my page and section source code or the demo site which had been deployed that package. Or will I send them to support team?

Thanks

Toan Mai,

Try to contact the support.

Show all comments

Hi,

I'm following this article (https://academy.bpmonline.com/documents/technic-sdk/7-12/how-add-button…) and its working but only showing 1 button

in code I tried to add 2 buttons but only the last button is showing

 

Any help will be highly appreciable.

 

Regards

Like 0

Like

4 comments
You must use unique "name" in diff

ex:

                {
                    "operation": "insert",
                    ..
                    "name": "Button1",
                    ..
                },
                {
                    "operation": "insert",
                    ..
                    "name": "Button2",
                    ..
                },
                ...

 

Hello Muhammad,

There is no limit of custom controls on edit page in bpm'online, you are able to add as much customizations as you need.
Please note on Dmitry`s comment, he is right, every control that is added to the edit page should have unique name to prevent collisions.
Please, in future, read articles with instructions more attentively :)

Hello Alex_Tim,

Thank you for suggestion. But kindly note that I realized and issue was already resolved.

If possible please help on other issues I posted I will be very thankful.

 

Regards

Show all comments