Hi experts,
Currently, I have a problem with dealing with the findRecord method.
This is the scenario:
1) I have two forms and two tables. Lets name it form A (with table A) & form B (with table B)
2) form A has a behavior where a record will be left as a history in form B when user makes any changes to the record.
3) form B, which has many histories of form A, is linked with a table relation of foreign key (between table A & B).
4) I overrode the the jumpRef method in form B's datasource, so that I could link it back to form A (I coded with jumpRef because of some other complexities)
5) form A receives the args from form B, and executes findRecord method, so that within the many records, the user could see where the selected record is.
6) Problem: Test message runs fine, with record being printed out as info. However, grid in form A is not being selected (even with the findRecord method used)
Note: *I thought I used findRecord wrongly. So I created a test button to manually find a particular record upon clicked, and it worked (this is happening in form A only. There is no jumping from form B to A)*
Could anyone please kindly guide me or tell me what am I doing wrong?
Thanks in advance!
This is the script (the script below is being executed inside the datasource's init method, which has been overridden by me):
private str initHeader()
{
info(funcName() + " has been executed");
TableA tableA;
str strRegId;
//if there is a caller form
if (element.args().caller())
{
switch(element.args().record().TableId)
{
case tableNum(TableA):
info("TableA has been detected"); //prints out fine
tableA = element.args().record();
//Find and select the specified TranId
info(strFmt("TranId %1 has been found. It will now be selected in the grid.", tableA.TranId)); //prints out fine
HISSMARepairObject_ds.findRecord(localHISSMARepairObject);//not working
//Assigning RefId to strRegId
strRegId = tableA.HISRegId;
break;
default:
info("Table not recognized.");
break;
}
}
return strRegId;
}