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

Hi Community,

 

I have built a Business Process that Triggers on "Record Added" for a Section.

My goal is that when I Create a Record in the section with OData using the "POST method", That custom business process should be triggered by System. But It is not getting triggered.

 

When I tried to create a new record from the system itself ( instead of OData ), the process got triggered. 

Can someone guide me on this? Is there any System Setting or specific configurations needed to be done?

 

I am using a cloud instance of 7.18.1.2800

Like 0

Like

3 comments
Best reply

Hi Pratik, 

This is the know issue of the version. 
Our R&D team is working on this to be fixed in the future releases. 
There's a workaround to this issue. To implement it please create following request to support team (since your instance is cloud) :
1) set "false" to following keys in  Terrasoft.WebApp\web.config 
<add key="Feature-UseSeparatedOdataEntitiesDll" value="false" />
<add key="Feature-ODataEntitiesCompilationInSeparatedDll" value="false" />
if such keys don't exist, they can be added to  the block <appSettings>;
2) Generate source code for all schemas and compile all. 

Please note, that this fix is only applicable for 7.18.1. Please remove this tags from web.config when updating to newer versions of the application, as it will cause the Odata functionality to not work. 

You can also refer to this community post in your support request. 
Best regards,
Yurii
 

Hi Pratik, 

This is the know issue of the version. 
Our R&D team is working on this to be fixed in the future releases. 
There's a workaround to this issue. To implement it please create following request to support team (since your instance is cloud) :
1) set "false" to following keys in  Terrasoft.WebApp\web.config 
<add key="Feature-UseSeparatedOdataEntitiesDll" value="false" />
<add key="Feature-ODataEntitiesCompilationInSeparatedDll" value="false" />
if such keys don't exist, they can be added to  the block <appSettings>;
2) Generate source code for all schemas and compile all. 

Please note, that this fix is only applicable for 7.18.1. Please remove this tags from web.config when updating to newer versions of the application, as it will cause the Odata functionality to not work. 

You can also refer to this community post in your support request. 
Best regards,
Yurii
 

Hi Yurii,

It Worked, Thanks for the help. 

Hi. 

This solution is for version 7.18.1 only.

Show all comments

we have a custom button on the section page that triggers a process.

When the business process returns to the section page code, is it possible to capture a return parameter from the process  ? how ?

Like 0

Like

1 comments

The issue is that the process will execute asynchronously. The only way to get the value back from the process is, instead of using it as an output param, to send it as a message using a script task in the process that you will retrieve with client-side code on the page. 

You can see an article outlining how to do this here: https://customerfx.com/article/sending-a-message-from-server-side-c-to-…

 

Basically, at the end of your process, you'll add a script task. In that script task you'll get the param value, then send it as a message (as outlined in the article). Then, in your page code, you'll listen for that message, check to make sure it's the message sent from your process, and then read the value and do whatever is needed with it.

Ryan

Show all comments

Hi Community,

 

We have this situation where we have a detail with products, and each product has a cost, a price and quantity. These products are added through an Excel Import and we want to know how can we "tell" our page that the Excel Import has finished and we want to update this specific fields. Any idea on how to implement this.

 

The Screenshot_6 shows both fields and detail I mentioned above.

 

Thanks in Advance.

 

Best Regards,

Pedro Pinheiro

File attachments
Like 0

Like

3 comments

Dear Pedro,

 

This business task can be implemented in several ways depending on the conditions of the task. You can either create a process that will be triggered on record modification or record adding and check if the record has a tag in with date like current date (since import creates a tag with the date and time) and change fields or you can read process log - if import process was started wait for some period of time and update all records with tag.

 

Best regards,
Angela
 

Angela Reyes,

I have tried to update my page using a process like you said but I'm facing the same issue. The process is not able to know whitch record page it needs to update. If I try to search by record modification or record adding it will generate problems in the future because it is possible for more than one user to import excel at the same time and each file imported has a lot of products.

 

Best regards,

Pedro Pinheiro

Pedro Pinheiro,

The easiest solution will be to import data using web-service instead of Import tool. The import process will never tell what data was imported - import tag is the only track that could show that records were imported. Import log contains more detailed information but it also does not contain information about import end.

 

Best regards,
Angela

Show all comments

If I wanted to redirect the Delete for an attachment detail record to a business process, instead of deleting the record, how would I do that?

Like 0

Like

1 comments

Dear Janine, 

To do this you need to create a replacing schema for FileDetailV2 and override method deleteRecords, starting process inside this method. To start process from the js code you can try the article below: 
https://customerfx.com/article/programmatically-starting-a-process-from-client-code-in-bpmonline/

Best regards,
Dennis 

Show all comments

Currently, if a process is started, it will run from all actions that do not have a previous step.  This means that troubleshooting a complex process requires inserting false branches if a step is to be skipped for testing, rather that just deleting undesired paths. Processes should only start from a Start event.  If a step does not have a Start event leading into it, it should be ignored.

3 comments

Dear Janine, 

Thank you for the idea! We've transferred this request to development team and this functionality may be added to future releases.

Best regards,
Dennis

System starts execution from all actions that do not have a previous step according to BPMN. This is a correct behaviour. 

That makes sense from the perspective of reading a process flow and process flow notation.  It doesn't make sense from a software development perspective.  There are many features in programming process flows in bpm'online that are not strictly about BPMN, but rather are about managing data and control of software.  I believe this is a case where not requiring a preceding Start event to run a branch doesn't make sense from the perspective of software usability and reliability.

Show all comments

Hi,

I'm trying to call a bp from a webservice that doesn't use authentication so i'm following the example provided: 

https://community.bpmonline.com/articles/web-service-without-authorizat…

When i try to set the parameter of the  business process i get the following error: 

Terrasoft.Common.InvalidObjectStateException: missing property "UsrNewInsertedEntityId" of type "ProcessComponentSet"
var UserConnection = this.SystemUserConnection;
var manager = UserConnection.ProcessSchemaManager;
var processSchema = manager.GetInstanceByName("UsrIncomingEntity");
var process = processSchema.CreateProcess(UserConnection);
if (processSchema.Parameters.ExistsByName("usrNewInsertedEntityId"))
{
    process.SetPropertyValue("UsrNewInsertedEntityId", msgId);
}
process.Execute(UserConnection);

Do i need to set anything on the BP process property?

Like 1

Like

8 comments

Hi Luciano, 

Please advise if you created your UsrIncomingEntity business process beforehand and if you added the usrNewInsertedEntityId parameter into it. Make sure you do that first.

If you did it, kindly provide us with the whole code so that we could have a look into it and advise on possible errors.

Thanks

Hello Luciano,

Basically, the code should work in appropriate way. As S.Kobizka said, you should check that business process with code "UsrIncomingEntity" exists and has  "usrNewInsertedEntityId" parameter. 

Also, I recommend try to choose "compile all" option in configuration, it may help because source code will be regenerated.

If you will have further difficulties, please, send the entire code of webservice and screenshots of the businessprocess.

Regards,
Alex

Alex_Tim,

Hi,

Thank you both for the answer, the BP exists prior to the webservice as well as the parameter. If i debug the code both the bp and the parameter are available to inspect. As soon as the line:

process.SetPropertyValue("UsrNewInsertedEntityId", msgId);

is executed i get the error.

I'll try the compile all option and then retest to  see if that helps.

Thanks

Luciano De Munno,
 

It seems that the reason of the issue is that msgId variable and UsrNewInsertedEntityId parameter in business process have different types. Please make sure that msgId is Guid and UsrNewInsertedEntityId is unique identifier http://prntscr.com/n0yt77

Regards,
Alex

Alex_Tim,

Hi Alex,

Thank you for the answer, i checked and msgId is a Guid and the parameter UsrNewInsertedEntityId has the type "Unique Identifier". AS far as i know that's the correct type i can try chaning both the string and text and then converting to guid inside the process to see if that helps.

Same thing, now i'm sending a string and expecting a string but the error is the same. 

Hello Luciano,

Here is the example of how to start business process with parameter from server side code.
If you will have further difficulties, please contact support team support@bpmonline.com

using Terrasoft.Core;
using Terrasoft.Core.Process;
using Terrasoft.Core.Process.Configuration;
 
ProcessSchema schema = UserConnection.ProcessSchemaManager.GetInstanceByName("LeadManagement");
//schema = UserConnection.ProcessSchemaManager.GetInstanceByUId(leadManagementProcessUId);
 
//different engines for interpretable and compiled BP
bool canUseFlowEngine = ProcessSchemaManager.GetCanUseFlowEngine(UserConnection, schema);
if(canUseFlowEngine) {
    var flowEngine = new FlowEngine(UserConnection);
    var param = new Dictionary<string, string>();
    param["LeadId"] = Entity.Id.ToString();
    flowEngine.RunProcess(schema, param);
} else {
    Process process = schema.CreateProcess(UserConnection);
    process.SetPropertyValue("LeadId", Entity.Id);
    process.Execute(UserConnection);
}        

Hi Alex,

The FlowEngine part did the trick. Thank you so much

Show all comments

Hi Community,

How can I call/trigger my business process under methods in client code?

Thanks

 

Like 0

Like

2 comments

This is solved

In order to trigger business process in Client Code, take the following actions: 1. Connect ProcessModuleUtilities module to a module of the page, from which the business process will be called.

2. Call executeProcess(args) method from ProcessModuleUtilities module by 

transferring args object with such properties.

Example

define("AccountPageV2", ["ProcessModuleUtilities"], function(ProcessModuleUtilities) {
    return {
        entitySchemaName: "Account",
        methods: {
            // Проверяет, заполнено ли поле [Основной контакт] страницы.
            isAccountPrimaryContactSet: function() {
                return this.get("PrimaryContact") ? true : false;
            },
            // Переопределение базового виртуального метода, возвращающего коллекцию действий страницы редактирования.
            getActions: function() {
                var actionMenuItems = this.callParent(arguments);
                actionMenuItems.addItem(this.getActionsMenuItem({
                    Type: "Terrasoft.MenuSeparator",
                    Caption: ""
                }));
                actionMenuItems.addItem(this.getActionsMenuItem({
                    "Caption": { bindTo: "Resources.Strings.CallProcessCaption" },
                    "Tag": "callCustomProcess"                
                }));
                return actionMenuItems;
            },
            // call you porcess
            callCustomProcess: function() {
                var contactParameter = this.get("PrimaryContact");
                var args = {
                    // Process name
                    sysProcessName: "UsrCustomProcess",
                    // parameters process
                    parameters: {
                        ProcessSchemaContactParameter: contactParameter.value
                    }
                };
                // run process
                ProcessModuleUtilities.executeProcess(args);
            }
        }
    };
});

 

Show all comments