Hi Creatio Community,

We're encountering a puzzling issue on a Freedom UI List Page (specifically, our Invoices_ListPage) when trying to run a business process (IWVoid_API_POST) using a custom JavaScript handler. The goal is to test the business process by explicitly passing a hardcoded InvoiceId, as requested for a specific testing scenario where the button is not on the individual record's form page.

Our Setup:

  1. The Button (Menu Item on List Page's ActionButton):

    We've added a crt.MenuItem to the ActionButton on our Invoices_ListPage. This menu item is intended for testing and is configured to trigger a custom handler:

    JSON

     

    // In viewConfigDiff of Invoices_ListPage.js
    {
        "operation": "insert",
        "name": "TargetVoidButton", //
        "values": {
            "type": "crt.MenuItem",
            "caption": "Test Void BP (Hardcoded ID)", 
            "icon": "debug-icon",
            "visible": true,
            "clicked": {
                "request": "crt.HandleButtonClickRequest",
                "params": {
                    "buttonName": "RunTargetVoidProcessHandler" 
                }
            }
        },
        "parentName": "ActionButton",
        "propertyName": "menuItems",
        "index": 3 
    }
  2. The Handler (in handlers array of Invoices_ListPage.js):

    This handler is designed to run the IWVoid_API_POST process with a specific, hardcoded InvoiceId.

    JavaScript

     

    // In handlers array of Invoices_ListPage.js
    {
        request: "crt.HandleButtonClickRequest",
        handler: async (request, next) => {
            if (request.buttonName === "RunTargetVoidProcessHandler") { 
                console.log("RunTargetVoidProcessHandler triggered.");
                Terrasoft.showInformation("Test: Running process with hardcoded ID. Check console.");
     
                const processName = "IWVoid_API_POST";
                const hardcodedInvoiceIdForTest = "3c2b6d9f-4c1e-4364-99f2-53956562b606"; 
                const parameterNameInProcess = "InvoiceId"; 
     
                console.log(`Test: Attempting to run BP '<span class="math-inline">\{processName\}' with EXPLICIT HARDCODED ID '</span>{hardcodedInvoiceIdForTest}' for parameter '${parameterNameInProcess}'.`);
     
                try {
                    const response = await request.$context.executeRequest({
                        type: "crt.RunBusinessProcessRequest",
                        params: {
                            processName: processName,
                            processParameters: {
                                [parameterNameInProcess]: hardcodedInvoiceIdForTest
                            },
                            saveAtProcessStart: false, 
                            showNotification: true 
                        }
                    });
     
                    console.log("Test: BP execution request completed. Response:", response);
     
                    if (response && response.success === true && response.processId && response.processId !== '00000000-0000-0000-0000-000000000000') {
                        const successMsg = `Test: BP '${processName}' (ID: ${response.processId}) initiated. Check Process Log.`;
                        console.log(successMsg);
                        request.$context.showInformationDialog?.(successMsg);
                    } else {
                        let errorMsg = `Test: Failed to start BP '${processName}'.`;
                        let serverDetails = (response && response.errorInfo && response.errorInfo.message) ? response.errorInfo.message : "Details unavailable or process not found (zero ID / success:false).";
                        errorMsg += ` ${serverDetails}`;
                        console.error(errorMsg, "Full response:", response);
                        request.$context.showErrorDialog?.(errorMsg);
                    }
                } catch (error) {
                    console.error(`Test: Exception for BP '${processName}':`, error);
                    let exceptionMsg = (error instanceof Error && error.message) ? error.message : "Client-side exception.";
                    if (error.errorInfo && error.errorInfo.message) {
                        exceptionMsg = error.errorInfo.message;
                    }
                    request.$context.showErrorDialog?.(`Test: Error triggering BP: ${exceptionMsg}`);
                }
                return; 
            }
            return next?.handle(request);
        }
    }

The Problem:

When we click the "Test Void BP (Hardcoded ID)" menu item, the handler triggers, and the client-side logs show the crt.RunBusinessProcessRequest is being prepared correctly with processName: "IWVoid_API_POST" and the hardcoded InvoiceId.

However, the server responds with:

{
  processId: '00000000-0000-0000-0000-000000000000', 
  processStatus: 0, 
  resultParameterValues: null, 
  executionData: null, 
  success: false, 
  errorInfo: {
    errorCode: "ItemNotFoundException",
    message: "Item process schema \"\" not found.", // Note the empty quotes for schema name
    stackTrace: null
  }
}

The key error is <strong>Item process schema "" not found.</strong>

What We've Tried:

  • Confirmed the schematic name (Code) of our business process is indeed IWVoid_API_POST.
  • Confirmed the input parameter in the BP designed to take the ID is named InvoiceId.
  • Repeatedly saved, compiled, and published the IWVoid_API_POST business process and ensured it's marked as "Active."
  • Checked the package containing the process for any errors and recompiled the package.
  • Performed thorough browser cache clearing and hard refreshes (Ctrl+F5).
  • We also have another menu item on the same list page ("VoidInvoice") that uses a declarative crt.RunBusinessProcessRequest with processRunType: "ForTheSelectedRecords" and parameterMappings: { "InvoiceId": "Id" }. When a record is selected and this menu item is clicked, it successfully starts the <strong>IWVoid_API_POST</strong> process (verified in Creatio Process Log with a non-zero instance ID). This makes the current error even more puzzling.

Our Questions for the Community:

  1. Why would the ProcessEngineService report Item process schema "" not found (with empty quotes for the schema name) when the processName: "IWVoid_API_POST" is explicitly and correctly provided in the params of crt.RunBusinessProcessRequest from our custom handler?
  2. Is there any known difference in how process names are resolved or how schemas are looked up by the server when crt.RunBusinessProcessRequest is invoked programmatically from a handler with processParameters explicitly set (using a hardcoded ID), versus when it's invoked declaratively with processRunType: "ForTheSelectedRecords" or processRunType: "ForTheSelectedPage"?
  3. Are there any deeper caching mechanisms (server-side, metadata) or specific registration steps for business process schemas that we might be missing, which could lead to this behavior only for the explicit parameter call?
  4. Has anyone encountered a similar situation where a process is findable/runnable via one SDK invocation method (declarative, context-based) but not another (programmatic handler, explicit parameters) from the same Freedom UI page type?

We are unable to access detailed server-side application logs for this specific environment at the moment, which is hampering deeper diagnosis from our end.

Any insights, suggestions, or similar experiences would be greatly appreciated!

Thank you!

Like 0

Like

0 comments
Show all comments

Dear colleagues,

 

I have this extract of piece of code

 const runProcessRequest = Ext.create("Terrasoft.RunProcessRequest", { 
       // El nombre del Proceso
       "schemaName": "NdosGeneracionMasivaNC_PRP", 

When I save a new version of the process, the name changes, in my case from NdosGeneracionMasivaNC_PRP to NdosGeneracionMasivaNC_PRPNCSNdosNotasCredyDeb_011,

 

The question is I must be concerned to those changes, to modify each schema code page where calling those processes?

 

I.e. change the code to:

 const runProcessRequest = Ext.create("Terrasoft.RunProcessRequest", { 
      // El nombre del Proceso
     "schemaName": "NdosGeneracionMasivaNC_PRPNCSNdosNotasCredyDeb_011", 

Thanks for your support

 

Regards

Julio Falcón

Like 0

Like

2 comments

Hello Julio,

 

You can check it by creating the code that uses one version of the process, triggering the code, go to the process log and checking if the process was triggered. Then create another version, set is as an actual process version and trigger the code again.  Once done go to the process log and see which process version is triggered and make a conclusion.

Thanks Oleg, of course I can try it, I do it very often with almost everything...but I would like to know what the documentation says about it, and I haven't found it.

 

Thanks

Show all comments

Dear colleagues,

 

If have a couple of process calls in a client module, very similar, one works and the another ones fails before to call the process getting a "400 (Bad Request)" error

 

Here is the code, the first one fails:

OnGeneraDetalleContratoBtnClick: function() { 
	// Guarda el registro, por si hubo cambios
	this.save();
 
	const RunProcessRequest = Ext.create( "Terrasoft.RunProcessRequest", { 
		// El nombre del Proceso
		"schemaName": "NdosCreaDetalleContrato", 
 
		// Parámetros de entrada
		"parameterValues": { 
			"NdosGrupoEconomicoID": this.get( "NdosGrupoEconomico" ),
			"NdosContratoID": this.get( "Id")
 
		},
 
		// Parámetros de Salida - True => Hay sucursales
		"resultParameterNames": [ 
			"NdosReturn"
 
		]
	} ); 
 
	// Ejecuta el proceso
console.log( RunProcessRequest );
// THIS gets error "400 (Bad Request)" here in the execute	//ERROR ERROR HERE HERE			
	RunProcessRequest.execute(function(response) { 
		// Si OK, actualiza el valor en funcion de la salida
		if (response.isSuccess()) { 
			// Actualiza la cantidad de meses que dura el contrato
			if ( response.resultParameterValues[ "NdosReturn" ] === true ) {
				// Tiene sucursales, inhablitita el boton...
				this.set( "NdosDetalleContratoGenerado", true );		
 
				}
		} 
	}, this ); 
},

 

This another wroks fine and are (as I saw identical!!)

// Jalcon - NoCode-Services - 20240110 - 
// Cambia alguna de las fechas del Contrato, debe ajustar la duración en meses del mismo
updateDuracionContratoMeses: function() { 
	const runProcessRequest = Ext.create("Terrasoft.RunProcessRequest", { 
		// El nombre del Proceso
		"schemaName": "Jfl_MesesEntreDosFechas", 
 
		// Parámetros de entrada
		"parameterValues": { 
			"NdosFechaInicial": this.get( "NdosFechaInicio" ), 
			"NdosFechaFinal": this.get( "NdosFechaFinContrato" )
		},
 
		// Parámetros de Salida
		"resultParameterNames": [ 
			"NdosCantidadDeMeses"
 
		] 
	}); 
 
	// Ejecuta el proceso
	runProcessRequest.execute(function(response) { 
		// Si OK, actualiza el valor en funcion de la salida
		if (response.isSuccess()) { 
			// Actualiza la cantidad de meses que dura el contrato
			this.set( "NdosMesesDuracionContrato", response.resultParameterValues[ "NdosCantidadDeMeses" ] ); 
 
			// Si el contrato ya tiene importe, cctualiza el importe del Contrato
			if( this.get( "NdosImporteMensualContrato" ) > 0 ) {
				this.set( "NdosMontoContrato", this.get( "NdosImporteMensualContrato" ) * this.get( "NdosMesesDuracionContrato" ) );
				}
 
		} 
	}, this); 
} 

 

This is part of the error, console log

 
       POST https://XXXXXX.creatio.com/0/ServiceModel/ProcessEngineService.svc/RunProcess 400 (Bad Request)
 
all-combined.js?v=8.1.1.3635:41 Error al enviar solicitud 
	estado de respuesta: 400 (Bad Request)
	url de solicitud: ../ServiceModel/ProcessEngineService.svc/RunProcess

Some ideas? please help

 

regards,

 

Julio Falcón

Like 0

Like

3 comments
Best reply

Hi Julio,

 

Just guessing, is "NdosGrupoEconomico" a lookup? The parameter is named with an Id, so assuming it is. If that is the case, you need to get it's value, right now it's sending the entire object from the lookup. 

For example (note, the .value at the end): 

"NdosGrupoEconomicoID": this.get("NdosGrupoEconomico").value

However, if it's possible that the lookup can be blank, might be a good idea to check for that as well.

Ryan

Hi Julio,

 

Just guessing, is "NdosGrupoEconomico" a lookup? The parameter is named with an Id, so assuming it is. If that is the case, you need to get it's value, right now it's sending the entire object from the lookup. 

For example (note, the .value at the end): 

"NdosGrupoEconomicoID": this.get("NdosGrupoEconomico").value

However, if it's possible that the lookup can be blank, might be a good idea to check for that as well.

Ryan

Hello Julio,

 

Can you please share the RunProcess request body (from the network tab in the console)? We can compare it to the successful calls and see the difference. Additionally you need to check if both retrieved values (using this.get getters) are strings.

Ryan Farley,

Thanks Ryan, you are right. Fortunately I had already found my mistake... almost a beginner's mistake :-(

Show all comments