FormDataSource.findValue Method [AX 2012]
Finds the specified value in the data source and makes the record that has that value the current record that uses the FormDataSource.findRecord method.
public boolean findValue(FieldId field, str value)
Run On
ClientParameters
- field
- Type: FieldId Extended Data Type
The field to search.
- value
- Type: str
The value to find.
The following example stores the ID of the current record before it tries to modify data. If the update fails, the data source is positioned on the original record.
void clicked()
{
DocuTypeId docuTypeId;
RecId activeRecId;
;
// Store current RecID
activeRecId = docuRef.RecId;
// Open the Document Type dialog.
docuTypeId = smmDocuments::getDocuTypeId(element.args().record());
try
{
ttsbegin;
if (docuTypeId)
{
// Create a new document record
docuRef_ds.create();
docuRef.RefTableId = tableReference;
docuRef.RefRecId = recReference;
docuRef_ds.write();
super();
}
ttscommit;
}
catch
{
// Focus moved back to original record if there is an error
docuRef_ds.executeQuery();
docuRef_ds.findValue(fieldnum(DocuRef,RecId),
int642str(activeRecId));
}
}
Community Additions
ADD
Show: