hello,
I add new field in table the I want to initialize this field using chain of command in class extension,
I add code like this :
[ExtensionOf(classStr(OutLogisticOrderOut))] final class OutLogisticOrderOut_Extension { public void createDetLOLine(Envelope _envelope, EnvLOOut _envLOOut, Warehouse _warehouse, ExchangeLineInfo _lineInfo) { Common sourceLine; DetLOLineOut detLOLineOut; SalesLine salesLine; sourceLine = this.retrieveSourceLine(_lineInfo); salesLine = sourceLine; detLOLineOut.PrepackGroupId = salesLine.Code; next createDetLOLine( _envelope, _envLOOut, _warehouse, _lineInfo); } }
the method createDetLOLine() : insert data in the table DetOLLine :
how can I use the chain of command : i initialize the field after or befor the next()?
Yes it will work. You are updating the value for custom field after the record get inserted in createDetLoLine method.
But to be more specific you can follow the workaround which i have mentioned previously.
Thanks,
Girish S.
Thanks Girish ,
I have another option , but I don't know if the logic is exact or no :
public void createDetLOLine(Envelope _envelope, EnvLOOut _envLOOut, Warehouse _warehouse,ExchangeLineInfo _lineInfo) { Common sourceLine; DetLOLineOut detLOLineOut; SalesLine salesLine; Detail detail next createDetLOLine( _envelope, _envLOOut, _warehouse, _lineInfo); sourceLine = this.retrieveSourceLine(_lineInfo); salesLine = sourceLine; select * from detail where detail.envelop == _envLOOut.envelop select * from detLOLineOut where detLOLineOut.envelop == detail.envelop if(detLOLineOut) { ttsbegin; detLOLineOut.PrepackGroupId = salesLine.EOLECodeBreak; detLOLineOut.update(); ttscommit; } } }
Yes you can, but somehow you need to bypass the call to standard createDetLoLine method and then call your custom method.
Another option will be using inheritance concept - create a new class and extend the class which is having createDetLoLine method - just copy the code along with method name and add code to populate values to custom field also.
Also keep in mind that you need to call the newly created class instead of parent class which is having createDetLoLine method. Meaning this class may be called somewhere or from the menu item. So you need to change that to your newly created class.
Thanks,
Girish S.
I can use the same code from the original method ,
just I change the name of method and insert the new field?
Then I think it won't be possible to get the buffer and assign a value using COC since the buffer is declared inside the method.
You can only access the variables in COC that is declared globally in the class.
You need to think of other way like using init value or insert method of table as mentioned earlier.
Thanks,
Girish S.
yes, its declared inside the method
Is the buffer 'detLOLineOut" is declared globally or declared inside the method 'createDetLoLine'?
I think its declared inside the method that's why you are getting the error.
intelli sense doesn't work
also I must use this class to initialize field
Check whether intelli sense is working - Just type the buffer name and see whether its showing any suggestion for that buffer.
If that doesn't work then try adding the logic on table level insert or initValue method before next keyword. But make sure you will have required values to assign it to your custom field.
Thanks,
Girish S.
I do the build of model with synch , but the same error .
the field existe in table.
when I add declaration of buffer in COC I don't get the error
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,836
Most Valuable Professional
nmaenpaa
101,156