Thomas
January 15, 2021, 8:46am
#1
I am trying to null object.
In schema X I have link to schema Y… This link is showing string of few values.
I have tried
doo.model.xxx.value = null
or
var AB = doo.model.xxx.value
AB.length = 0
Is there any way to delete values from linked field?
micu
January 15, 2021, 4:08pm
#2
Hi Thomas,
We are working on simplifying the lookup value setup.
If you need it now, please use this workaround:
if (doo.model.xxx.value.id) {
doo.model.xxx.value = { id: null, originalId: doo.model.xxx.value.id, _$$changed: true }
}
Regards
Michal
Thomas
January 15, 2021, 7:52pm
#3
Where is it wrong?
doo.model.<[Přidružení k dokumentu (pav_PridruzDokument)]>.value = {
dokumenty_Popis: null,
originalId: doo.model.<[Přidružení k dokumentu (pav_PridruzDokument)]>.value.dokumenty_Popis,
_$$changed: true
}
Thanks for help.
Thomas
January 15, 2021, 8:00pm
#4
Well I have schema X, where is field linked to another schema Y.
And for some type at schema X I need to clear some fields before save
if (doo.model.<[Typ (pav_Typ)]>.value ==='Bilance') {
doo.model.<[Příjem na (pav_PrijemNa)]>.value = null;
doo.model.<[Přidružení k dokumentu (pav_PridruzDokument)]>.value = {...};
}
where doo.model.<[Přidružení k dokumentu (pav_PridruzDokument)]>.value is field with link to schema Y.
1 Like
micu
January 17, 2021, 6:35pm
#5
I guess you did not setup the id property. Check the example again, please:
if (doo.model.xxx.value.id) {
doo.model.xxx.value = { id: null, originalId: doo.model.xxx.value.id, _$$changed: true }
}
Thomas
January 20, 2021, 9:24am
#6
Maybe I am blind, but I guess id is set as dokumenty_Popis .
doo.model.<[Přidružení k dokumentu (pav_PridruzDokument)]>.value = {
dokumenty_Popis: null,
originalId: doo.model.<[Přidružení k dokumentu (pav_PridruzDokument)]>.value.dokumenty_Popis,
_$changed: true
}
micu
January 20, 2021, 1:12pm
#7
I am afraid the system is looking for id property. It is necessary to point to the record by id.
In the next version, we publish setValue method for lookup. Currently, we are testing that.
Maybe - if you can wait few days, it could be easier for you.
I will ask for detail the dev team.
Regards
Michal