diff --git a/README.md b/README.md index 60e41101..4e291696 100644 --- a/README.md +++ b/README.md @@ -396,6 +396,12 @@ ignoreLWCActivationCards: true Otherwise these are now on by default. +To disable the local compilation of the FlexCards so that the npmAuthKey is used only for the local compilation of OmniScript. In this case legacy method would be used for the FlexCard LWC activation: + +``` +ignoreLocalCompilationCards: true +``` + In cases where there is a specific executable path for Chrome, or there is no interest in the use of its headless feature, it is possible to do as follows: ``` puppeteerHeadless: false @@ -453,6 +459,12 @@ when set to false or ommited, this is the expected output: ![Bindings](doc/deployGeneratedLwcWithSfdxCli.png) +To keep OmniScript activated post deployment and activation, in case of LWC deployment failure, Please add below parameter: + +``` +keepOSActiveWhenLWCDeploymentFails: true +``` + *obs: At the moment, configuring this property only affects OmniScript / FlexCards local compilation step* # The Job File @@ -769,7 +781,7 @@ The Job file additionally supports some Vlocity Build based options and the opti ## Job Options | Option | Description | Type | Default | | ------------- |------------- |----- | -----| -| activate | Will Activate everything after it is imported / deployed | Boolean | false | +| activate | Will Activate everything after it is imported / deployed | Boolean | true | | addSourceKeys | Generate Global / Unique Keys for Records that are missing this data. Improves ability to import exported data | Boolean | false | | autoFixPicklists | Makes metadata changes across orgs for Vlocity Managed Package fields automatically propagate and eliminates errors due to this missing metadata. Does not work for Managed Global Value Sets - Like Vlocity's CurrencyCode field. | Boolean | true | | autoRetryErrors | Will automatically retry after a deploy to see if any errors can be fixed by retrying due primarily to references that did not correctly resolve | Boolean | false | @@ -1030,6 +1042,7 @@ These types are what would be specified when creating a Query or Manifest for th | DocumentTemplate | DocumentTemplate__c
DocumentTemplateSection__c
DocumentTemplateSectionCondition__c | | EntityFilter | EntityFilter__c
EntityFilterCondition__c
EntityFilterMember__c
EntityFilterConditionArgument__c | | IntegrationProcedure | OmniScript__c
Element__c | +| IntegrationRetryPolicy | IntegrationRetryPolicy__c | | InterfaceImplementation | InterfaceImplementation__c
InterfaceImplementationDetail__c | | ItemImplementation | ItemImplementation__c | | ManualQueue | ManualQueue__c | diff --git a/lib/datapacksjob.js b/lib/datapacksjob.js index 1dbed051..8dc831bc 100644 --- a/lib/datapacksjob.js +++ b/lib/datapacksjob.js @@ -2820,9 +2820,33 @@ DataPacksJob.prototype.deployJob = async function(jobInfo) { ); } } catch (err) { - VlocityUtils.log(err); - jobInfo.errors.push( "Exception while deploying compiled LWC components:\n" + JSON.stringify(err, null, 2)); - jobInfo.hasError = true; + if (jobInfo.keepOSActiveWhenLWCDeploymentFails) { + if (err.result && err.result.details && err.result.details.componentSuccesses) { + err.result.details.componentSuccesses + .forEach((metadata) => { + if (metadata.componentType) { + var metadataKey = `${metadata.componentType}/${metadata.fullName}`; + VlocityUtils.success('Metadata Deployed', metadataKey); + jobInfo.currentStatus[metadataKey] = 'Success'; + } + } + ); + err.result.details.componentFailures + .forEach((metadata) => { + if (metadata.componentType) { + var metadataKey = `${metadata.componentType}/${metadata.fullName}`; + VlocityUtils.error('Metadata Deployment Failed - ' + metadata.problem, metadataKey); + jobInfo.currentStatus[metadataKey] = 'Failure'; + } + } + ); + } + VlocityUtils.log('Skipping Deactivation of OmniScript as keepOSActiveWhenLWCDeploymentFails = true. As per this param, Deployed OmniScripts will remain active irrespective of LWC is deployed or not.'); + } else { + VlocityUtils.log(err); + jobInfo.errors.push("Exception while deploying compiled LWC components:\n" + JSON.stringify(err, null, 2)); + jobInfo.hasError = true; + } } } } diff --git a/lib/datapacktypes/flexcard.js b/lib/datapacktypes/flexcard.js index b49f4dc7..8526e88c 100644 --- a/lib/datapacktypes/flexcard.js +++ b/lib/datapacktypes/flexcard.js @@ -160,26 +160,28 @@ FlexCard.prototype.onDeployFinish = async function(jobInfo) { if (idsArray.length < 1){ return; } - - //--------Load Flexcard compiler------- - // Make sure we load the package version - await this.vlocity.utilityservice.getPackageVersion(); - - const compilerName = 'flexcard-compiler'; - const namespace = this.vlocity.namespace; - const packageVersion = this.vlocity.PackageVersion; - - const flexCardsCompiler = await VlocityUtils.loadCompiler(compilerName, - jobInfo, packageVersion, namespace); - if(flexCardsCompiler){ - for (let i = 0; i < idsArray.length; i++) { - let flexCardID = idsArray[i]; - await this.compileFlexCardsLwc(flexCardID,jobInfo,flexCardsCompiler) ; - } + if (!jobInfo.ignoreLocalCompilationCards){ + //--------Load Flexcard compiler------- + // Make sure we load the package version + await this.vlocity.utilityservice.getPackageVersion(); + + const compilerName = 'flexcard-compiler'; + const namespace = this.vlocity.namespace; + const packageVersion = this.vlocity.PackageVersion; + + const flexCardsCompiler = await VlocityUtils.loadCompiler(compilerName, + jobInfo, packageVersion, namespace); + if(flexCardsCompiler){ + for (let i = 0; i < idsArray.length; i++) { + let flexCardID = idsArray[i]; + await this.compileFlexCardsLwc(flexCardID,jobInfo,flexCardsCompiler) ; + } + } else{ + hasFlexCardCompiler= false; + } } else{ - hasFlexCardCompiler= false; - } - + hasFlexCardCompiler= false; + } } catch (e) { hasFlexCardCompiler= false; VlocityUtils.error('Error while loading Flexcard Compiler', e); diff --git a/lib/datapacktypes/omniscript.js b/lib/datapacktypes/omniscript.js index 3c7e0007..f4e105f8 100644 --- a/lib/datapacktypes/omniscript.js +++ b/lib/datapacktypes/omniscript.js @@ -95,19 +95,23 @@ OmniScript.prototype.createTitleObjects = function (input) { return titleObjects; }; -OmniScript.prototype.deactivateOmniScript = async function (omniscriptID) { +OmniScript.prototype.deactivateOmniScript = async function (omniscriptID, jobInfo) { const osAPIName = this.vlocity.namespace + '__OmniScript__c'; const osAPIActiveFieldName = this.vlocity.namespace + '__IsActive__c'; var toUpdate = {}; toUpdate[osAPIActiveFieldName] = false; toUpdate.Id = omniscriptID; try { - var result = await this.vlocity.jsForceConnection.sobject(osAPIName).update(toUpdate); - if (!result.success) { - VlocityUtils.error('Deactivating OmniScript ', 'Id: ' + omniscriptID + ' Unable to deactivate OmniScript. OmniScript is still activated.'); - } - else { - VlocityUtils.log('Deactivating OmniScript ', omniscriptID, 'OmniScript was deactivated'); + if (jobInfo && jobInfo.keepOSActiveWhenLWCDeploymentFails) { + VlocityUtils.log('Skipping Deactivation of OmniScript - ' + omniscriptID + ' as keepOSActiveWhenLWCDeploymentFails = true. As per this param, Deployed OmniScript will remain active irrespective of LWC is deployed or not.'); + } else { + var result = await this.vlocity.jsForceConnection.sobject(osAPIName).update(toUpdate); + if (!result.success) { + VlocityUtils.error('Deactivating OmniScript ', 'Id: ' + omniscriptID + ' Unable to deactivate OmniScript. OmniScript is still activated.'); + } + else { + VlocityUtils.log('Deactivating OmniScript ', omniscriptID, 'OmniScript was deactivated'); + } } } catch (error) { VlocityUtils.error('Deactivating OmniScript ', 'Id: ' + omniscriptID + ' Unable to deactivate OmniScript. OmniScript is still activated - ' + error); @@ -402,7 +406,7 @@ OmniScript.prototype.compileOSLWC = async function (jobInfo, omniScriptId, omniS jobInfo.currentErrors[omniScriptKey] = 'LWC Activation Error >> ' + omniScriptKey + ' - ' + e; jobInfo.errors.push('LWC Activation Error >> ' + omniScriptKey + ' - ' + e); VlocityUtils.error('LWC Activation Error', omniScriptKey + ' - ' + e); - await this.deactivateOmniScript(omniScriptId); + await this.deactivateOmniScript(omniScriptId, jobInfo); try { browser.close(); diff --git a/lib/vlocitycli.js b/lib/vlocitycli.js index e7d747f3..6e74a659 100755 --- a/lib/vlocitycli.js +++ b/lib/vlocitycli.js @@ -106,8 +106,10 @@ var VLOCITY_COMMANDLINE_OPTIONS = { "puppeteerHeadless": Boolean, "ignoreLWCActivationOS": Boolean, "ignoreLWCActivationCards": Boolean, + "ignoreLocalCompilationCards": Boolean, "puppeteerHttpProxy": String, - "overrideOrgCommit": String + "overrideOrgCommit": String, + "keepOSActiveWhenLWCDeploymentFails": Boolean }; var VLOCITY_COMMANDLINE_OPTIONS_SHORTHAND = { diff --git a/lib/vlocityutils.js b/lib/vlocityutils.js index bf3f6257..82fe0b95 100644 --- a/lib/vlocityutils.js +++ b/lib/vlocityutils.js @@ -233,7 +233,7 @@ VlocityUtils.loadCompiler = async function (nameOfCompiler, jobInfo, packageVers return await VlocityUtils.requirePlugin(jobInfo, lwcCompiler, lwcCompilerVersion); } catch (err) { VlocityUtils.log(`Can also install compiler with npm install ${lwcCompiler}`); - VlocityUtils.error('An error occurred while loading OmniScript compiler: ' + err + ' - If you are using Puppeteer for LWC compilation this error can be ignored'); + VlocityUtils.log('An error occurred while loading OmniScript compiler: ' + err + ' - If you are using Puppeteer for LWC compilation this error can be ignored'); return null; } } \ No newline at end of file