"but because there can be weekend days there is also a text field..."
You may get away with that, but it's better to use a number field instead of a text field for this.
"Now I have a portal with "line items" and they have a lookup field that looks up the "actual amount of days".."
There are several different mechanisms for achieving that result. Which one did you use and why do you need this value copied to every line item in the portal? Would a calculation that refers to this "number of days" field in the parent record also work for you? (It should avoid the need for forcing the commit here.)
"You may get away with that, but it's better to use a number field instead of a text field for this."
You are right. That was a dumb one on my behalf. When I wrote "text field" in my post I didn't even mean that the field type was text but when I double checked in my database that field actually was set to the text type in stead of number.
I changed it but it doesn't change the behaviour of the lookup.
"There are several different mechanisms for achieving that result. Which one did you use"
It's simply a lookup field in my line items table that looks up the value in my invoice table.
"why do you need this value copied to every line item in the portal?"
Because most of the time people rent a bunch of items for the entire period (the period it takes to shoot a film)
And in addition they will often come and rent certain items for shorter periods of time. Like one or two days.
So by default it's the "actual amount of days" but sometimes it's less.
So I do need this value to be seperate for every line item.
Thanks for your suggestions.
Ok, I am pretty sure I found a suulution :)
For the field that needed an extra commite in order to work i created a "Commit Record" script trigger on the "OnObjectValidate".
This way when you type in something the field defenitely gets committed.
I also have a field with two radio boxe that have an auto value. In order to force a commit on those (because you might not change those)
I created a script that would go to that field and would commit the record. I placed that script on the script trigger of "OnLayoutEnter"
Seems to be working nicely sofar :)