RE: How to dynamically add a record type?
Answered
When dynamically adding record type I get the following error:
The record type [RECORD.TYPE.WORK_ORDER_ISSUE] is invalid.
Here is the function:
async function transform(recObj){
try{
let curRecord = await record.transform.promise({
fromType: recObj.fromType,
fromId: recObj.fromId,
toType: recObj.toType,
//toType: record.Type.WORK_ORDER_ISSUE,
isDynamic: false
})
log.debug(‘157’, curRecord);
await curRecord.save.promise();
return curRecord;
}
if I replace
fromType: recObj.fromType,
toType: recObj.toType,
with fromType: record.Type.WORK_ORDER,
toType: record.Type.WORK_ORDER_ISSUE,
if works fine without errors.
values for :
fromType is record.Type.WORK_ORDER a string
toType is record.Type.WORK_ORDER_ISSUE a string
Best answer
Hi,
So is the string ‘record.Type.WORK_ORDER’?
If so, that will not work. Are you not able to pass record.Type.WORK_ORDER directly to the function?
Failing this, since these are enumerations, you can just use the string they represent, i.e. ‘workorder’.
Thanks,
Chris