Hi Avijit,

This should help you:
https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context

So you only need to pass "delegator" to your DataUtils::getCompanyName method, 
it's already present.

To convince yourself, you may also look for "delegator" in "*een*.xml, 
*form*.xml"

HTH

Jacques

Le 25/05/2022 à 15:38, Avijit Bose a écrit :
Dear Sir,

I have a java class...
-------------------
public class DataUtils {

  public static final String module = DataUtils.class.getName();

  public static String getCompanyName(String customerId) {
Debug.logInfo("=======customerId=========", customerId);

return customerId;
  }
-------------------

I am calling this class from ...
------------------------
<entity-options entity-name="AkmMasterEnquiry" key-field-name="customerId"
description="${customerId} -
${groovy:com.akm.exim.events.DataUtils.getCompanyName(customerId);}">
-----------------------

It's calling the class and working fine until now, but I have to make
a database query using this...
-------------------
GenericValue newlyCreatedValues99 = EntityQuery.use(delegator)
           .from("AkmCustomer")
           .where(EntityCondition.makeCondition("customerId",
EntityOperator.EQUALS, customerId))
           .orderBy("customerId")
           .queryOne();
-------------------

Question: How do I get "Delegator" in the above java class without
passing 'HTTPRequest' or 'DispatchContext' in the
'getCompanyName(String customerId)' method (I can only pass
customerId). Because I am calling the class from a FORM from where I
cannot pass 'HTTPRequest' or 'DispatchContext'.

Pls help.
regards
Avijit

Reply via email to