RE: Getting 500 error code while using https.get API in Suitelet Script

I want to call user event script from suitelet. I am using https.get API. But Getting error code 500. Below is my code:

/**
*@NApiVersion 2.x
*@NScriptType UserEventScript
*/
define ( [‘N/record’,’N/search’,’N/ui/dialog’,’N/https’,’N/url’,’N/currentRecord’,’N/http’,’N/format’] ,
function(record,search,dialog, https,url, currentRecord,http,format) {

function afterSubmit(context) {

if(context.type == ‘create’ || context.type == ‘edit’){
var rec=context.newRecord;
log.debug(“rec”,rec);
var recId=rec.id;
log.debug(“recId”,recId);
//Load Work order
var work_Order_obj = record.load({
type: record.Type.WORK_ORDER,
id: recId,
isDynamic: true
});
log.debug(“work_Order_obj”,work_Order_obj);

//Get Document Number
var docNumber = work_Order_obj.getValue({
fieldId: ‘tranid’
});
log.debug(“docNumber”,docNumber);

var suiteLetURL = url.resolveScript({
deploymentId: ‘customdeploy_suitelet_work_order_issue’,
scriptId: ‘customscript_suitelet_work_order_issue’,
returnExternalUrl: true,
params: {‘internalId’: recId, ‘documentNumber’:docNumber}
});
//log.debug(“params”,suiteLetURL.params);
log.debug(‘suiteLetURL’, suiteLetURL);

var request = https.get({
url: suiteLetURL

});
log.debug(“request”,request);

}

}
return {
// beforeLoad: myBeforeLoad,
//beforeSubmit: beforeSubmit,
afterSubmit: afterSubmit
};
});

Maira S Beginner Asked on February 15, 2023 in SuiteScript.
Add Comment
7 Answers

Hi,

Apologies for my delay. I see you have just posted a similar question. Is this question still valid?

If so, could please share some screenshots of your Suitelet deployment. In particular, audience, roles, etc?

Thanks,

Chris

Advanced Answered on February 23, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.