Difference between revisions of "Function to Retrieve Account Object Data"

From LongJump Support Wiki
imported>Aeric
 
imported>Aeric
(Replaced content with "{{Deprecated|Old example.}} {{Deprecated_page|8.0|80}}")
 
Line 1: Line 1:
{{Deprecated|Old example.}}
{{Deprecated|Old example.}}


This example gets credit rating data in an account record.
{{Deprecated_page|8.0|80}}
 
<pre>
// Function: getAccountCreditRating
// The function takes an account number as a parameter. It creates a search
// string using the account number and retrieves the value of the
// credit_rating field.
 
String accountNumber = functionParams.get("number");
 
HashMap data = new HashMap();
 
String searchStr = "number = '" + accountNumber + "'";
Result result = Functions.searchRecords("ACCOUNT", "credit_rating", searchStr );
int resultCode = result.getCode();
if(resultCode < 0)
{
    // Some error happened.
    String msg = "Account could not be retrieved";
    Functions.debug(msg + ":\n" + result.getMessage());  // Log details
    Functions.throwError(msg + ".");                    // Error dialog
}
else if(resultCode == 0)
{
  // No records found. Take action according to your business logic
  Functions.throwError("Account could not be found");
}
else
{
  //Records retrieved successfully
  ParametersIterator iterator = result.getIterator();
  if (iterator.hasNext())
  {
    Parameters params = iterator.next();
    data.put("credit_rating", params.get("credit_rating"));
  }
}
 
return data;
</pre>

Latest revision as of 00:22, 9 February 2012

Warn.png

DEPRECATED: Old example.


For information on this deprecated functionality, see the version 8.0 platform docs:
https://agileappscloud.info/lj80/index.php?title=Function_to_Retrieve_Account_Object_Data