I had saved current Username in voicher say Created By, It works fine, what i have ascenario, that SO will be created by UserA, DN, will be by User2, and Final SaleBill by User3, then whenever i create SO its ok, it saves User1, but when i select DN with user2 login. It shows User2 in the field, but the moment i select the SO number, it changes the UDF to User1, which is wrong, same is the case with Sale bill, In short, When Tracking is done, the Createdby name is picked from SO/DN. Plz help me to overcome it, as this udf is used for this voucher. Plz guide how to achieve it ;;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ [System : UDF] VchCrtBy : String : 144 [#Part: VCH Narration] Add : Line: At Beginning : VchNarration Vch Auth [Line: VchNarration Vch Auth] Field: Simple Field, VchCreate Local: Field: Simple Field: Set As: $$LocaleString:"Created By :" Local: Field: Simple Field: Width: 15 Local: Field: Simple Field: Skip: Yes [Field: VchCreate] Use: Name Field Set As : IF $$InCreateMode THEN ##SVUserName ELSE $VchCrtBy Set Always : Yes Storage: VchCrtBy Skip: Yes ;;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
When You select a tracking Eg. SO to DC. All The Created UDF are get copied from Tracking Object. See the Function VchFill. In your case you want a layer in udf. ? for this i think you would achive with the following code. and it will work in all voucher or you can spceify it with voucher Type Also [#form : Voucher] Add : Option : Onformacceptuserlock : (@@Issales Or @@IsSalesOrder) And $$InCreatemode [!form : Onformacceptuserlock] On : Form Accept : (Yes And $$InCreateMode) : Call : FuncCopyUserNameInUdf [Function : FuncCopyUserNameInUdf] 010 : Insert Collection Object : yourudfname 011 : SET TARGET : YourUdfName 012 : SET VALUE : Yourudfname : ##SvCurrentUser 013 : SET TARGET : .. ;;This Will Create a layer in the voucher. So user creation will get in line 1 DC user creation will get in line 2 and in sales will get line3. i had not tested the code just writed it as come in mind. but sure that will work
Respected Sirs, It gives error while saving SO, attached code FUNCTION: 'FuncCopyUserNameInUdf' LABEL: 012 : Action execution failed!
Read the code without copy pasting it ( in line 12 I writen : YourUDFname that means The udf which you declared that name