Since we have Client tier (AX Client) and Server tier (AOS), so if we want to execute our method on client then we can set the method modifier to ‘client’ and if we want to execute the method on server than we can set the modifier to ‘server’.Also if don’t set and modifier to the method then method will be run based on the ‘RunOn’ property of the class.If the RunOn property of the class is set to ‘Called From’ then method can either be executed on client or server.
// Sets the RunOn property to Client.
client static boolean myMethod()
{
// ToDo Insert code here.
}
Above method will be run on AX
client
// Sets the RunOn property to Server.
server static boolean myMethod()
{
// ToDo Insert code here.
}
Above method will be run on AOS
But we can also do this(see below) which apparently make the property of the method to ‘Called from’
// Sets the RunOn property to
Called from.
client server static boolean
myMethod()
{
// ToDo
Insert code here.
}
Example1(Client modifier):
We have a table called
‘JournalizingDefinition’ which has a static method ‘lookupRefCtrlJournalizingDefByModule’
which has a ‘Client’ modifier declare. Now this method will always
we be used for a form lookup field on a ‘Transaction Posting Definition’ form
Transaction Posting Definition form
Now on a lookup field of the form this method is being used
several times for different module(see below).So basically it means that this
method will never be used on Server side that’s why it is set to Client(AX
Client)
Example 2 (Server modifier):
We have a class
‘LedgerJournalPost’ which has a method called ‘Post’ which is apparently used
when we try to ‘Post’ a journal.
So
it mean that this method will always be called on Server AOS for posting
purposes.
No comments:
Post a Comment