12-05-2009 11:02 AM
Very time-sensitive question. Hope somebody is around today.
I have to default some values for the underlying db table as part of the Mobile 5.5 page save in order for computations to work when they are opened in our customized web page for Opportunities. I have tried a few methods and found soemthing that works for presetting fields already visible on the form within the BaseOpportunity class as in
businessObject.setProperty(TableManager.RESERVED_COLUMN_NAME_varname) , but what I still need to set are 3 more fields not present on the mobile form and in the customized opportunity table in the db.
Here I am stuck, it seems that maybe there is a function in the sage.mobile.common.BusinessObject class, but I cannot seem to find where to look for that. When I search the server folders, all that turns up are other files that reference it with import lines. Google turns up zip as does the forum search. Reasonably new to Java and Mobile, which compounds the problem, and was up half the night running dozens of permutations to no avail.
Any pointers to where the class is lurking so I can try to take a look at it or is there some other method that would get this done?
Thanks in advance,
12-08-2009 08:24 AM
This can be done use in formshow for new opportunities with the following code:
public void formShow()throws SageMobileException
// some code....
// Set value to default.
CMPEditField xyz1 = (CMPEditField)super.getControl("Potential");
String xyz2 = xyz1.getValue();
double xyz3 = Double.parseDouble(xyz2);
CMPEditField abc1 = (CMPEditField)super.getControl("probability");
String abc2 = abc1.getValue();
double abc3 = Double.parseDouble(abc2);
double total = xyz3 * abc3;
SetFieldValue("Desc", " "+total);
The above example will allow to set some values for form fields, when user will add a new opportunity. I have tested with the available fields on Opportunity, you can add your custom fields instead.
Hope this helps.