Change values of form items when duplicating [x-post: coresuite customize rules]
Kiril Valev
Hi,I have a userdefined TextEdit on my purchases form. When I duplicate a purchase the userdefined value is duplicated as well. I want to avoid this behaviour.
Up until now I have the following logic:
1. Capture the Duplicate click Event
2. Get the active form in an optimizer rule and change the value of my TextEdit to an empty String.
Works great, BUT the cursor is doing some ugly jumping across the form and you can actually see how the values are changed. Is there a possibility to change the value of the TextEdit, before the values are loaded into the form? Neither the before event property, nor the FormDataLoad event are fulfilling my requirement.
Thank you!
Paolo Manfrin
Hi Kiril, did you try setting the Form.Freeze(true) before starting the cleanup and Form.Greeze(False) after it?hth
paolo
Kiril Valev
Hi Paolo,yes, I did. Here is my source:
[CODE]
/*
Clean value when duplicating.
*/
// Get calling Form
Form frm = Form.GetFormFromUID(SwissAddonFramework.B1Connector.GetB1Connector().Application.Forms.ActiveForm.UniqueID);
try
{
// Ignore everything except purchases and freeze the form.
if(!frm.Type.Equals("141")) return true;
frm.Freeze(true);
// Clean the value of the TextEdit
TextEdit.GetFromUID(frm, "UDF_1").Value = "";
// Since the focus is set to the previously cleaned TextEdit, restore the focus and point to the Businesspartner TextEdit
TextEdit.GetFromUID(frm, "4").Active = true;
return true;
}
catch(Exception e)
{
StatusBar.WriteError(e.Message);
return true;
}
finally
{
frm.Freeze(false);
}
[/CODE]
0
Please sign in to leave a comment.
Comments
0 comments