You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Im working on a project which uses VLocity. I created a component that is currently using one single method from the Vlocity namespace, called "fetchCustomLabels". Because of that I also had to set my component to use the "vlocity_cmt" namespace. The component works perfectly on my org but when I access it on the dev server it throws a compilation error. And I think the reason for that to happen is because the compiler can't resolve the "import { fetchCustomLabels } from "vlocity_cmt/utility";" as this library comes from a package, which is not present in the current working directory, but it is installed on my org. I can't conclude with certainty what is causing the compilation error because the error message does not say what is happening. Look below what I see
Here is an image of the component working on the org
To Reproduce
/*eslint-disable @lwc/lwc/no-inner-html, no-unused-vars, consistent-return*/import{LightningElement,wire,api}from'lwc';import{getRecord,getFieldValue}from'lightning/uiRecordApi';import{fetchCustomLabels}from"vlocity_cmt/utility";constQUESTION_SHEET='Case.QuestionSheet__c';exportdefaultclassTroubleshootFlowResultextendsLightningElement{
@apirecordId='5000Q00000FqJ85QAF';questions;record;errors;staticCustomLabels=['couldNotFindCustomLabel']
@wire(getRecord,{recordId: '$recordId',fields: [QUESTION_SHEET]})fetchCaseRecord({ error, data }){if(error){this.errors=reduceErrors(error);console.error('Error loading the Record',error);}elseif(data){this.record=data;constquestionSheet=getFieldValue(this.record,QUESTION_SHEET);if(questionSheet){constquestions=JSON.parse(questionSheet.replace(/"/g,'"'));returnfetchCustomLabels([...this.getCustomLabels(questions), ...this.staticCustomLabels]).then((customLabels)=>{this.questions=this.prepareQuestions(questions,customLabels);})}this.questions=null;}}prepareQuestions(questions,customLabels){questions.forEach((entry)=>{entry.Label=customLabels[entry.CustomLabel]||customLabels.couldNotFindCustomLabel;entry.Options.forEach((option)=>{option.Label=customLabels[option.CustomLabel]||customLabels.couldNotFindCustomLabel;option.Class='option slds-text-align_center slds-m-right_x-small '+(option.Value===entry.Value ? 'answer' : '');});});returnquestions;}getCustomLabels(questions){constcustomLabels=newSet();questions.forEach((entry)=>{if(entry.CustomLabel)customLabels.add(entry.CustomLabel);entry.Options.forEach((option)=>{if(option.CustomLabel)customLabels.add(option.CustomLabel);});});returnArray.from(customLabels);}getisLoading(){return!this.errors&&!this.record;}}functionreduceErrors(errors){if(!Array.isArray(errors)){errors=[errors];}return(errors// Remove null/undefined items.filter((error)=>!!error)// Extract an error message.map((error)=>{// UI API read errorsif(Array.isArray(error.body)){returnerror.body.map((e)=>e.message);}// UI API DML, Apex and network errorselseif(error.body&&typeoferror.body.message==='string'){returnerror.body.message;}// JS errorselseif(typeoferror.message==='string'){returnerror.message;}// Unknown error shape so try HTTP status textreturnerror.statusText;})// Flatten.reduce((prev,curr)=>prev.concat(curr),[])// Remove empty strings.filter((message)=>!!message));}
Describe the bug
Im working on a project which uses VLocity. I created a component that is currently using one single method from the Vlocity namespace, called "fetchCustomLabels". Because of that I also had to set my component to use the "vlocity_cmt" namespace. The component works perfectly on my org but when I access it on the dev server it throws a compilation error. And I think the reason for that to happen is because the compiler can't resolve the "import { fetchCustomLabels } from "vlocity_cmt/utility";" as this library comes from a package, which is not present in the current working directory, but it is installed on my org. I can't conclude with certainty what is causing the compilation error because the error message does not say what is happening. Look below what I see
Here is an image of the component working on the org
To Reproduce
Expected behavior
Component using external lib should resolve the import automacally and should not throw compilation exception
Desktop (please complete the following information):
Additional context
N/A
The text was updated successfully, but these errors were encountered: