mvanta
2nd June 2022, 09:49
Good morning all!
We have created a cdf (string) on table cisli220 and we assign a value on it and we want this value to be copied when the user is using system functionality duplicate from session cisli2520m000.
Please advice,
Maria
JaapJD
2nd June 2022, 12:40
CDF values are copied by default to the new record. There may be a few exceptions for more complex objects, but on cisli220 it seems to work.
mvanta
2nd June 2022, 12:53
Hello JaapJD!
It is not copying the values of the cdf in our case.
I created a table extension and added in the before save hook the code below and it worked.
if update.db = dupl.occur then
cisli220.cdf_orid=cisli220.cdf_orid
endif
Maria
JaapJD
2nd June 2022, 13:00
Imho it cannot be this code that solves your problem. Your assignment of cisli200.cdf_orid does nothing...
mvanta
2nd June 2022, 13:03
It works JaapJD.
I have assigned a value on the cdf though extension and when duplicating it keeps the value.
Maria
mvanta
7th June 2022, 13:22
JaapJD can you please explain to me why you said it will not work?
Cause although it (seems) to work for cdf, it is not working for table fields!
Your expertise is needed once more time!
Thank you for your help!
mvanta
JaapJD
7th June 2022, 17:29
This code
cisli220.cdf_orid=cisli220.cdf_orid
does nothing at all, so it cannot be the solution for a CDF keeping the original value during duplicate.
Probably other code in your table extension populates the CDF initially and also during duplicate. If you post your extension script here, I can check.
mvanta
8th June 2022, 14:05
JaapJD,
this is my table extension (before save) in cisli220,
function extern long before.save.object(long mode)
{ if update.db = dupl.occur then
cisli220.cdf_orid=cisli220.cdf_orid |original ms id
endif
return (0)
}
And I have a session extension with a calculated field where I assign the value in the cdf,
function extern void cisli220.cdf_orid.before.input()
{
|* Use this hook to perform actions before input to
|* an input field starts.
cisli220.msid=cisli220.cdf_orid
}
Maria