tmannais
11th March 2019, 08:13
Hi,
I have been trying to find a hook in Extension that is similar to before.input in session script.
I have tried almost every hook in both Extension type Table and Session but no luck.
Anyone has an idea for this?
Regards,
Thana
Ajesh
11th March 2019, 09:39
This is from the standard Document
Note: A Standard Field extension type is only valid for sessions of type Print, Update and Update_print.
Use a Standard Field extension type if additional validations of updating of related fields are requiredin the session’s screen.
A Custom Field extension type is only valid for sessions of these types:
•
Print
•
Update
•
Update_print.
Use a Custom Field extension type if you must specify additional input on the session’s screen.
.
Or if its a CDF, those fields sections can be applied.
What is the requirement? Cant it be done in Table Extension? (before.save.object)
tmannais
11th March 2019, 09:49
Hi Ajesh,
The requirement is to disable and set a value for a field in tdsls1501m000 (Sales Quotation Line) on adding a new record with a condition from a field before this field, and before the record is saved.
For example,
1. Create a new record.
2. Select Item "AAA" (anything)
3. Press Tab
4. Before the cursor enters Quantity field, it should have a condition that checks if the item is "AAA" if it is then disable it and set a fixed value to quantity field, otherwise leave the quantity field enabled without fixing its value (as if nothing happens).
Regards,
Thana
Ajesh
11th March 2019, 10:35
So why don't you use the Readly only hook of quantity for SQ Line? If the Item is "AAA" then assign it some value and return the read.only hook as True?
tmannais
11th March 2019, 10:42
I tried it, but it is not working as expected.
tmannais
11th March 2019, 11:18
I got a workaround for this particular case now.
I used Extension type Session. Inside it, create a new Calculated field.
The Calculated Field will trigger its function on every field very similar to before.field of every field it passes -- almost what I was looking for.
I then put the condition inside the function and make it set the quantity value and disable field using disable.fields(READONLY, "tdsls101.qoor", actual.occ).
It is now working as expected. The only limitation is that the Calculated Field needs to be displayed in the session. If it is hidden then the function will not trigger as if the Calculated Field is deactivated.
Thank you Ajesh for helping.
Case closed.
JaapJD
15th March 2019, 11:55
Straightforward way to implement your requirement is using the Is Derived and Update hooks for the Ordered Quantity in the table extension for tdsls101.
For example:
Is Derived hook:
function extern boolean tdsls101.qoor.is.derived(long mode)
{
if strip$(tdsls101.item) = " 055" then
return(true)
endif
return(false)
}
Update hook:
function extern void tdsls101.qoor.update(long mode)
{
if strip$(tdsls101.item) = " 055" then
tdsls101.qoor = 55
endif
}
hsmhsmhsm
20th May 2022, 09:15
Good explanination