---------------------------------- OnRename() ---------------------------------- message('From rename'); MyFunction; ----------------------------------- Cross-Reference No. - OnValidate() ----------------------------------- message('From validate'); MyFunction; ------------------------------------ MyFunction() ------------------------------------ message('called myfunction');
Do you want to rename the record?
from validate
called myfunction
from rename
called myfunction
----------------------------------- Form - OnModifyRecord() : Boolean ----------------------------------- IF "Cross-Reference No." <> xRec."Cross-Reference No." THEN AlreadyCalled := TRUE;
---------------------------------- OnRename() ---------------------------------- message('From rename'); IF NOT AlreadyCalled THEN MyFunction; AlreadyCalled := FALSE; ----------------------------------- Cross-Reference No. - OnValidate() ----------------------------------- message('From validate'); MyFunction; ------------------------------------ MyFunction() ------------------------------------ message('called myfunction');
Comments
When you are Creating Function MyFunction Create it with parameter
MyFunction(CalledFrom)
if CalledFrom='FromValidate' then
//Dovalidate related actions
if CalledFrom='FromRename' then
// doRename related action
while calling this function call with respective parameters
hope this helps.
If your primary Key has only field "Cross Reference No." Then Remove call of myFunction From OnRename Record or Onvlaidate.
Because whenever you call Onvalidate automatically OnRename will be called
1. Let's say I want the logic in MyFunction to run only during OnValidate calls. If I perform "Item Cross Reference".Rename() from code, I don't get an OnValidate call!
2. Let's say i want the logic in MyFunction to run only during OnRename calls. If I perform "VALIDATE("Cross Reference No.",'123456') from code, I don't get an OnRename call!
I think I need to do something like this:
With this setup, I just need to set AllowFunction to TRUE prior to explicitly calling a Rename.
Systems Analyst
NAV 2009 R2 (6.00.34463)