they could help me please..
# general
g
they could help me please..
b
The error says that you are trying to load a record that does not exist
g
thank for you response.👍
this is my record
b
And although i dont think it is an issue yet, you are not using the promise correctly
g
var btnEjecutar = function() { debugger; var loadRecord= record.load({ type: 'customrecord_axa_paises', id: 701 }); for (var i = 0; i < loadRecord.length; i++) { var element = loadRecord[i]; objRecord.getValue({ fieldId: 'Nombre_Pais' }); console.log(element); } }
so I get the same mistake
m
record.load
would return a single record object, why are you iterating on it?
g
I want to just show the logs in a console.log
b
What does the stacktrace for the non promise look like
g
this would be so,but it is no that i'm doing wrong.
debugger; var loadRecordPromise = record.load.promise({ type: 'customrecord_axa_paises', id: 701 }); loadRecordPromise.then(function(objRecord) { for (var i = 0; i < loadRecordPromise.length; i++) { var element = loadRecordPromise[i]; objRecord.getValue({ fieldId: 'Nombre_Pais' }); } console.log(element); }, function(e) { console.log('error' + e); });
m
Do you just want to load a record and get the value of a field? Then all you need is
Copy code
var loadRecord= record.load({
    type: 'customrecord_axa_paises',
    id: 701
});
var value = loadRecord.getValue({ 
   fieldId: 'Nombre_Pais'
});
console.log(value);
Or promise version
Copy code
record.load.promise({
    type: 'customrecord_axa_paises',
    id: 701
}).then(function(objRecord) {
    var value = loadRecord.getValue({ 
       fieldId: 'Nombre_Pais'
    });
    console.log(value);
});
b
All the code that @Gustavo Andrade has shared looks like it does nothing if the record exists
Hes offered proof that the record exists, so my guess is that other code is causing problems
g
well, with the nicole code perform and run it as well, but the same error comes out, and the record is correct, I know it's simple but I don't understand that error..
I'm going to create a new clientscript and refer it again, since this code has other functions and maybe that's generating conflict, thank you guys for your answers.
👍👍
m
@Gustavo Andrade just try run those lines in the browser console, but import the record module first
Copy code
require(['N/record']);
var record = require ('N/record');
g
if I'm with a clienscript and I use N/record
m
I am saying if you want to quickly test out just those lines you don't have to make a new client script. You can just run it directly in the browser console as long as you have imported the module first.
Anyways it's 3am and I am off the bed. Good luck
g
@michoel thanks for you helpme... i've been helped a lot by his answers.
thanks again.