Slig
08/20/2021, 1:14 PM//Carrega registro Term
/*var objTerm = record.load({
type: record.Type.TERM,
id: 193,
isDynamic: true
});
*/
//Carrega registro Fatura
var objFatura = record.load({
type: record.Type.INVOICE,
id: 4952604,
isDynamic: true
});
//Obtém valor da campo duenextmonthifwithindays que está dentro da fatura Term
/*var nTerm = objFatura.getValue({
fieldId: "duenextmonthifwithindays"
});
*/
var anyData = "20/11/2021";
var AcceptNTerm = format.format({
value: anyData,
type: format.Type.DATE
});
//Define valor de duedate com o valor obtido do objeto objTerm
objFatura.setValue({
fieldId: "custrecord_gf_data_prevista",
value: AcceptNTerm,
ignoreFieldChange: false
});
var recordId = objFatura.save({
enableSourcing: true,
ignoreMandatoryFields: false
});
return recordId;
}Damree Ilyaad
08/20/2021, 2:19 PMDamree Ilyaad
08/20/2021, 2:19 PMSandii
08/20/2021, 2:20 PMsetText instead of setValue . As I said yesterday, setText is for strings, setValue is for dates. format.format returns a string, you could try using format.parse instead as well, I personally would just avoid using N/format completely.Slig
08/20/2021, 2:36 PMSlig
08/20/2021, 2:38 PMSlig
08/20/2021, 4:56 PMSandii
08/20/2021, 4:56 PMSandii
08/20/2021, 4:58 PMSlig
08/20/2021, 5:04 PMSlig
08/20/2021, 5:06 PMSandii
08/20/2021, 5:09 PMsetText with a date string, if you want to use setValue to change it, then you need to give a Date, not a stringSandii
08/20/2021, 5:10 PMvar anyData = "20/11/2021";
var AcceptNTerm = format.format({
value: anyData,
type: format.Type.DATE
});
anyData and AcceptNTerm are both strings, they will not work with setValueSlig
08/20/2021, 5:38 PMDamree Ilyaad
08/20/2021, 5:46 PMSlig
08/20/2021, 5:59 PM