business process that receives parameters from a client module "400 (Bad Request)" on call to execute

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