hi, in search for vendor bill it shows createdfrom...
# suitescript
r
hi, in search for vendor bill it shows createdfrom and its purchase order too but when i go to that record from the search itself and try to get the value of the created from field by in my script
Copy code
var createdFrom = currentRecord.getValue({
        fieldId: "createdfrom",
      });
it shows empty
n
Share the full code.
s
@razer456 i'm guessing, firstly, by code from PO, you need to do record.transform, by this process, when you transform the po to vendor bill, it will necessarily have created from on the PO.
r
it dont will work with code ... but still here is a snippet... shows false with or without created from value.. i tried to use saved search but wont work on create gives error... maybe try to use workflow action script ??
Copy code
//script to call suitelet that will in turn validate the approverlist in purchase order
define([
    "N/url",
    "N/https",
    "N/log",
    "N/search",
    "N/runtime",
    "N/currentRecord",
  ], function (url, https, log, search, runtime, currentRecord) {
    function saveRecord(context) {
      //get current transaction record
      var currentRecord = context.currentRecord;
  
      var importedFromProspectCheckBox = currentRecord.getValue({
        fieldId: "custbody_cet_imported",
      });
      
      var createdFrom = currentRecord.getValue({
        fieldId: "createdfrom",
      });

    
  if(!createdFrom)
  {
     
  
          //get values by using getValue method
  
          var approverList = currentRecord.getValue({
            fieldId: "custbody_cet_approverlist",
          });
  
        
  
          if (approverList == "") {
            alert("Please select approver");
            return false;
          } else if (createdByFld == approverList) {
            alert("You cannot select yourself as an approver");
            return false;
          }
}
n
Can you try with nlapiGetFieldValue('createdfrom') and see if it works.