cancel
Showing results for 
Search instead for 
Did you mean: 

multiple selection of a listpicker with a createentity action

former_member675984
Participant
0 Kudos

Hi Experts

I am trying to store all selected items from a list picker with a create entity action. I enable the allowmultipleselection property of the list picker, and now I need to assign the selected items to an entity in the OData service, I am trying with a createentity action, but it always stores 1 single item from the list picker.

How can I assign the selected items from the list picker to the OData service in my MDK application?

Also try a rule with all selected items, and was unsuccessful, it also stores in entity 1 item.

export default function ValidarFechaPlan(clientAPI){
	let dialogs = clientAPI.nativescript.uiDialogsModule;
	var pageproxy = clientAPI.getPageProxy();
	var fc_rec = pageproxy.evaluateTargetPath('#Page:CrearTareaEquipoPage/#Control:FC_PERNR_REC/#Value');
	//return fc_rec.toString();
 	fc_rec.forEach(c => {return `${c.ReturnValue.toString()}`});
}

What do you recommend me to do?

Greetings from Colombia

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

juanforero98

Help me in understanding your requirement. Could you share a POSTMAN request example how you are sending multiple values for a single property ?

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member675984
Participant
0 Kudos

Thanks jitendrakumar.kansal,

but I have already managed to solve the problem, in the forEach() cycle, I store the value of the current position in a global variable, a clientdata variable or a control, and I execute the action odata create entity, and to the property of the Entity Odata I assign the variable, so the OData action is executed updating the value of the field in each execution.

var receptoractual; 
export default function ValidarFechaPlan(clientAPI){
	var pageproxy = clientAPI.getPageProxy();
	receptoractual = clientAPI.evaluateTargetPath('#Page:CrearTareaEquipoPage/#Control:position'); 
	var fc_rec = pageproxy.evaluateTargetPath('#Page:CrearTareaEquipoPage/#Control:FC_PERNR_REC/#Value');
	fc_rec.forEach(c => {
		receptoractual.setValue(`${c.ReturnValue.toString()}`);	
		clientAPI.executeAction('/HmOffice/Actions/OData/ActividadEquipo_CreateEntity.action').then(
				(success) => Promise.resolve(success),
				(failure) => Promise.reject('fallo al ejecutar la accion: ' + failure));
	});
	return clientAPI.executeAction('/HmOffice/Actions/CloseModalPageComplete.action').then(
		(success) => Promise.resolve(success),
		(failure) => Promise.reject('fallo al ejecutar la accion: ' + failure)
	);
}