私は購入レコードの契約レコードから値を探していましたが、値があるフィールドを取得できませんでした。以下はそのコードです。私はこのコードを契約記録に適用しており、機能は提出前のものです。 私は間違った方法で検索を適用していると思います。事前に購買発注レコードの契約レコードからfileldの値を検索したい
function srchfield()
{
var recordid = nlapiGetRecordId() //retunrs the contract id
nlapiLogExecution('DEBUG', 'recordid ', recordid);
var recordtype = nlapiGetRecordType(); //retunrs the contract recordtype = jobs
nlapiLogExecution('DEBUG', 'RecordType', recordtype);
var loadrecord = nlapiLoadRecord(recordtype, recordid); //loads the record
nlapiLogExecution('DEBUG', 'Load Record', loadrecord);
var contractname = nlapiGetFieldValue('entityid'); //returs the value of the field contractname whose fieldid is = entityid
nlapiLogExecution('DEBUG', 'ContractName ', contractname);
var filters = new Array();
new nlobjSearchFilter('entityid', null, 'anyof', contractname); // entityid is field id in contract Record and contractname is defined above for contract record
// nlapiLogExecution('DEBUG', 'SearchFilter', filters);
var columns = new Array();
new nlobjSearchColumn('custbodycontract'); // custbodycontractis field id in PO Record
var searchresults = nlapiSearchRecord('purchaseorder', null, filters, columns);
for (var i = 0; searchresults != null && i < searchresults.length; i++)
{
var searchresult = searchresults[ i ];
var record = searchresult.getId();
var rectype = searchresult.getRecordType();
var cntrct_name= searchresult.getValue('custbodycontract');
}
}
おかげ
明確にする:これらの契約エンティティによってPOを検索していますが、別のPOフィールド「custbodycontract」があります。それは何を保持していますか? – TonyH
これは、契約フィールドからエンティティを検索しているPOのフィールドのフィールドIDです。 – Galdiator
コントラクト名 – Galdiator