From e69b0a45546815647c391d59da7b6262719a038d Mon Sep 17 00:00:00 2001 From: SushilMallRC Date: Wed, 8 Jan 2025 17:52:54 +0530 Subject: [PATCH] Include timezone while adding datetime --- src/adapters/netsuite/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/adapters/netsuite/index.js b/src/adapters/netsuite/index.js index d3bb153a..3207c676 100644 --- a/src/adapters/netsuite/index.js +++ b/src/adapters/netsuite/index.js @@ -277,7 +277,7 @@ async function createCallLog({ user, contactInfo, authHeader, callLog, note, add if (user.userSettings?.addCallLogSubject?.value ?? true) { comments = upsertCallSubject({ body: comments, title }); } if (user.userSettings?.addCallLogContactNumber?.value ?? true) { comments = upsertContactPhoneNumber({ body: comments, phoneNumber: contactInfo.phoneNumber, direction: callLog.direction }); } if (user.userSettings?.addCallLogResult?.value ?? true) { comments = upsertCallResult({ body: comments, result: callLog.result }); } - if (user.userSettings?.addCallLogDateTime?.value ?? true) { comments = upsertCallDateTime({ body: comments, startTime: callLog.startTime, timezoneOffset: user.timezoneOffset }); } + if (user.userSettings?.addCallLogDateTime?.value ?? true) { comments = upsertCallDateTime({ body: comments, startTime: callStartTime, timezoneOffset: user.timezoneOffset }); } if (user.userSettings?.addCallLogDuration?.value ?? true) { comments = upsertCallDuration({ body: comments, duration: callLog.duration }); } if (!!callLog.recording?.link && (user.userSettings?.addCallLogRecording?.value ?? true)) { comments = upsertCallRecording({ body: comments, recordingLink: callLog.recording.link }); } if (!!aiNote && (user.userSettings?.addCallLogAINote?.value ?? true)) { comments = upsertAiNote({ body: comments, aiNote }); } @@ -399,9 +399,9 @@ async function updateCallLog({ user, existingCallLog, authHeader, recordingLink, const callLogResponse = await axios.get(`https://${user.hostname.split(".")[0]}.suitetalk.api.netsuite.com/services/rest/record/v1/phonecall/${existingLogId}`, { headers: { 'Authorization': authHeader } }); let comments = callLogResponse.data.message; let patchBody = { title: subject }; + let callStartTime = moment(moment(startTime).toISOString()); + let startTimeSLot = moment(startTime).format('HH:mm'); if (startTime !== undefined && duration !== undefined) { - let callStartTime = moment(moment(startTime).toISOString()); - let startTimeSLot = moment(startTime).format('HH:mm'); try { const getTimeZoneUrl = `https://${user.hostname.split(".")[0]}.restlets.api.netsuite.com/app/site/hosting/restlet.nl?script=customscript_gettimezone&deploy=customdeploy_gettimezone`; const timeZoneResponse = await axios.get(getTimeZoneUrl, { @@ -426,7 +426,7 @@ async function updateCallLog({ user, existingCallLog, authHeader, recordingLink, } if (!!note && (user.userSettings?.addCallLogNote?.value ?? true)) { comments = upsertCallAgentNote({ body: comments, note }); } if (!!subject && (user.userSettings?.addCallLogSubject?.value ?? true)) { comments = upsertCallSubject({ body: comments, title: subject }); } - if (!!startTime && (user.userSettings?.addCallLogDateTime?.value ?? true)) { comments = upsertCallDateTime({ body: comments, startTime, timezoneOffset: user.timezoneOffset }); } + if (!!startTime && (user.userSettings?.addCallLogDateTime?.value ?? true)) { comments = upsertCallDateTime({ body: comments, startTime: callStartTime, timezoneOffset: user.timezoneOffset }); } if (!!duration && (user.userSettings?.addCallLogDuration?.value ?? true)) { comments = upsertCallDuration({ body: comments, duration }); } if (!!result && (user.userSettings?.addCallLogResult?.value ?? true)) { comments = upsertCallResult({ body: comments, result }); } if (!!aiNote && (user.userSettings?.addCallLogAINote?.value ?? true)) { comments = upsertAiNote({ body: comments, aiNote }); }