Scripting
The purpose of this page is to discuss iDempiere's scripting ability. You have the ability automate tasks without creating a plugin. This is accomplished by creating System Admin role => Rule records and calling these records from iDempiere's standard developer extensions like processes and callouts.
Pros and Cons of Scripting
Pros
- No development environment needed
- Simple automation tasks can be completed quickly
Cons
- You lose the benefit of source code control to review, track and deploy code
- You lose the debugging tools of a development environment
- You are limited to simple tasks. You can do more with plugins.
Chuck's Opinion: I do not use scripting. Once you go to the effort of setting up your development environment and learning the plugin architecture, there are few reasons to use scripting. I prefer to be consistent in how I deploy changes.
Examples
Simple Callout
import org.compiere.model.MOrgInfo;
MOrgInfo orginfo = MOrgInfo.get(A_Ctx, Integer.valueOf(G_AD_Org_ID), null);
if(A_Value == orginfo.getDropShip_Warehouse_ID())
{
A_Tab.setValue("IsDropShip", "Y");
}
else
{
A_Tab.setValue("IsDropShip", "N");
}
result="";