Retrieving Parameters for DAL Process and Callouts in OpenbravoERP

Process:

In OpenbravoERP, when we write DAL Process, the first thing that we would need are the input parameters with which we can operate on the Window. By default there are some key parameters passed to the process bundle. They are:

1. Record ID

2. Tab Id

3. Client ID

4. Org ID

These values are presented to the user as key-value pairs. They can be retrieved as provided below:


String id=(String) bundle.getParams().get("TDS_Process_Pay_ID");
String id=(String) bundle.getParams().get("tabId");

The Catch here is that the key-value pairs are Case Sensitive. So the case of your name matters. But more often than not we cannot guess the case of our element variables. Instead of playing the guessing game you can use a very useful method provided in the same process bundle class, which is bundle.getParamsDefalated().This method returns all the process parameters that can be used in the process as a single string delimited by {[key1,value1]}. One example string that was retrieved is provided here.

Bundle {“map”:{“entry”:[{“string”:[“adOrgId”,””]},{“string”:[“tabId”,”9EB442F0BD9141319FAF085EF30D7CC9″]},{“string”:[“TDS_Process_Pay_ID”,”FF8081812EB2DA4C012EB2DD8117001A”]},{“string”:[“adClientId”,””]}]}}

Using this you can make sure you provide the right name to retrieve the process parameters.
Callout:

Callouts are a cool feature in Openbravo that helps us in defaulting fields and validating them at runtime. There is a simplecallout class defined in Openbravo using which we can extend and write our own callouts easily and effectively.For basics about developing callouts refer here. Even in callouts you have to retrieve the field’s value that you want to operate upon and set in the same manner. More often I see people confusing themselves between the parameter for Callout and process. The input field is usually prefixed  by ‘inp’ and the variable names are camel cased.For eg if the database field name is ‘first_name’, the field can be retrieved using the following command,

</pre>
String firstName = info.getStringParameter("inpfirstName",null);

And in case of Numeric fields, this command can be used.

BigDecimal noofbed = info.getBigDecimalParameter("inpnoOfBed");

And its easily a best practice to include logger so that you can record the status of the Process/Callout. You have to import the org.apache.log4j.Logger for this purpose. The logger can be instantiated and used as follows:

private static Logger log = Logger.getLogger(TrialProgram.class);
log.info("Displaying Sample Information");
Advertisements

About Shankar Balachandran
Technical Manager, Openbravo operations, Kailao Consulting Private Limited

15 Responses to Retrieving Parameters for DAL Process and Callouts in OpenbravoERP

  1. Pingback: Understanding OBDal in Openbravo « Fugo Consulting

  2. Pingback: Understanding OBDal in Openbravo | myErp

  3. Pingback: Reference Types in Openbravo « Fugo Consulting

  4. Pingback: Retrieving last changed value in Openbravo Callout « Fugo Consulting

  5. Pingback: Setting Date field in Openbravo Callout « Fugo Consulting

  6. Pingback: Passing Parameters to Stored Procedures in Openbravo « Fugo Consulting

  7. Pingback: Setting Date field in Openbravo Callout « Shaan – Openbravo Developer, India, Fugo

  8. Pingback: Retrieving last changed value in Openbravo Callout « Shaan – Openbravo Developer, India, Fugo

  9. Pingback: Understanding OBDal in Openbravo « Shaan – Openbravo Developer, India, Fugo

  10. Pingback: Retrieving last changed value in Openbravo Callout « Openbravo Technical Development – Do's and Dont's

  11. Pingback: Setting Date field in Openbravo Callout « Openbravo Technical Development – Do's and Dont's

  12. Pingback: Understanding OBDal in Openbravo « Openbravo Technical Development – Do's and Dont's

  13. Pingback: Setting Date field in Openbravo Callout – Shankar Balachandran

  14. Pingback: Retrieving last changed value in Openbravo Callout – Shankar Balachandran

  15. Pingback: Understanding OBDal in Openbravo – Shankar Balachandran

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: