Hi! I'm trying to Update multiple records in a Sharepoint List, the column I want to update is a record column. And I get different errors. First, I'll share my code:
Set(
LastSavedGemba,
Patch(
Gemba5S,
Defaults(Gemba5S),
{
Title: "GEMBA-5S-00000",
Nombre: "GEMBA-5S-00000",
Fecha: Now(),
MiniCia: DataCardValue3.Selected,
Participante: DataCardValue4.Text,
MaterialNecesario: DataCardValue5.Value,
Layout: DataCardValue6.Value,
LugarCorrespondiente: DataCardValue7.Value,
Señalizacion: DataCardValue26.Value,
AcuerdosLimpieza: DataCardValue9.Value,
AnalisisLimpieza: DataCardValue10.Value,
AcuerdosGenerales: DataCardValue39.Value,
Revisiones: DataCardValue25.Value,
Realizacion: DataCardValue23.Value,
Entrenamiento: DataCardValue30.Text,
Explicacion: DataCardValue31.Text,
Importancia: DataCardValue32.Text,
Ventajas: DataCardValue33.Text,
MantencionLimpieza: DataCardValue34.Text,
FrecuenciaLimpieza: DataCardValue16.Text,
EstimulacionGerencia: DataCardValue14.Text,
ProblemasMejoras: DataCardValue20.Text,
CalificacionLimpieza: DataCardValue29.Value,
Mejoras: DataCardValue35.Text,
PropuestasImplementadas: DataCardValue36.Text,
Progreso: DataCardValue37.Text,
Reconocimiento: DataCardValue38.Text
}
).ID
);
Set(
LastGembaName,
Concatenate(
"GEMBA-5S-",
Text(
Value(LastSavedGemba),
"[$-en-US]00000"
)
)
);
UpdateIf(
Gemba5S,
ID = LastSavedGemba,
{
Nombre: LastGembaName,
Title: LastGembaName
}
); UpdateIf(Acciones, ID in AccionesIdCollection.IdAccion, { IDGemba: LastSavedGemba.ID });
ResetForm(Gemba5SForm);
Refresh(Gemba5S);
Navigate(
[@Gemba5SHome],
ScreenTransition.Fade
);
I'm setting a variable (LastSavedGemba) with the result of a Patch method. I already tried the patch method by it's own and it's working fine. Then I need to update the name of this record, but I have no trouble doing that neither. But, after that, I have a collection of "Actions Identifiers" (this actions where previously saved and the collection does have records) and I want to update the Sharepoint List "Acciones" where the ID is in the collection and set the field GembaID (which references the first Sharepoint List, the one we applied the Patch function). The Sharepoint list currently has two columns referencing that Sharepoint List (name of the list: Gemba5S): IDGemba and IDGemba:Nombre. So, the IDGemba is a Lookup field (so does the IDGemba:Nombre) and I've tried the code above and of course it throws me this error:
Incompatible type. The 'IDGemba' column in the data source you're updating expects a 'Record' type and you're using a 'Number' type
And if I change the code to this (selecting the full saved record instead of just the ID):
Set(
LastSavedGemba,
Patch(
Gemba5S,
Defaults(Gemba5S),
{
Title: "GEMBA-5S-00000",
Nombre: "GEMBA-5S-00000",
Fecha: Now(),
MiniCia: DataCardValue3.Selected,
Participante: DataCardValue4.Text,
MaterialNecesario: DataCardValue5.Value,
Layout: DataCardValue6.Value,
LugarCorrespondiente: DataCardValue7.Value,
Señalizacion: DataCardValue26.Value,
AcuerdosLimpieza: DataCardValue9.Value,
AnalisisLimpieza: DataCardValue10.Value,
AcuerdosGenerales: DataCardValue39.Value,
Revisiones: DataCardValue25.Value,
Realizacion: DataCardValue23.Value,
Entrenamiento: DataCardValue30.Text,
Explicacion: DataCardValue31.Text,
Importancia: DataCardValue32.Text,
Ventajas: DataCardValue33.Text,
MantencionLimpieza: DataCardValue34.Text,
FrecuenciaLimpieza: DataCardValue16.Text,
EstimulacionGerencia: DataCardValue14.Text,
ProblemasMejoras: DataCardValue20.Text,
CalificacionLimpieza: DataCardValue29.Value,
Mejoras: DataCardValue35.Text,
PropuestasImplementadas: DataCardValue36.Text,
Progreso: DataCardValue37.Text,
Reconocimiento: DataCardValue38.Text
}
)
);
Set(
LastGembaName,
Concatenate(
"GEMBA-5S-",
Text(
Value(LastSavedGemba.ID),
"[$-en-US]00000"
)
)
);
UpdateIf(
Gemba5S,
ID = LastSavedGemba.ID,
{
Nombre: LastGembaName,
Title: LastGembaName
}
); UpdateIf(Acciones, ID in AccionesIdCollection.IdAccion, { IDGemba: LastSavedGemba });
ResetForm(Gemba5SForm);
Refresh(Gemba5S);
Navigate(
[@Gemba5SHome],
ScreenTransition.Fade
);
It now gives me this error:
Missing column. Your formula is missing a column 'Id' with a type of 'Number'.
Any ideas regarding how can I fix this? Please, help me 😞