Lex Sub Customers Import
Introduction
This will import lex sub customers.
download sample sub-customers import file.
Fields
Lex Sub Customers Import
| Column Position | Lex Sub Customer Contract Fields | Map to ViSN Column Name | Description | Max length | Rules | Mandatory | Default Value | Example | 
|---|---|---|---|---|---|---|---|---|
| A | IGNORE | IGNORE | IGNORE | IGNORE | IGNORE | IGNORE | IGNORE | IGNORE | 
| B | IGNORE | IGNORE | IGNORE | IGNORE | IGNORE | IGNORE | IGNORE | IGNORE | 
| C | CustomerAccountNo | Account Number | Account Number | 15 | A-Z & 0-9 and special characters | Y | ASI537945 | |
| D | CustomerName | Customer Name | Customer Name | 100 | A-Z & 0-9 and special characters | N | Heaney - Rath | |
| E | StandardInstructions | Customer Policy Notes | Customer Policy Notes | 8000 | All Characters and Special Characters | N | The TCP port is down, reboot the bluetooth protocol. | |
| F | MaintenanceControllerNotes | MaintenanceControllerNotes | 8000 | All Characters and Special Characters | N | The TCP port is down, reboot the bluetooth protocol so we can input the CSS panel! | ||
| G | ContactName | Contact Name | Contact Name | 100 | A-Z & 0-9 and special characters | N | Kaycee | |
| H | TelephoneNumber | Contact Number | Customer Contact number | 11 | 0-9 numbers | N | 01234567891 | |
| I | eMailAddress | Contact Email | Customer Contact Email address | 50 | All Characters and Special Characters | N | jitendra+djkoce@digitalinnk.com | |
| J | TyreBrandPreference1 | TyreBrandPreference1 | 10 | All Characters and Special Characters | N | DFGH-THYU | ||
| K | TyreBrandPreference2 | TyreBrandPreference2 | 10 | All Characters and Special Characters | N | DFGH-TPYU | ||
| L | TyreBrandPreference3 | TyreBrandPreference3 | 10 | All Characters and Special Characters | N | DFGH-TUDU | ||
| M | TyreBrandPreference4 | TyreBrandPreference4 | 10 | All Characters and Special Characters | N | DFGH-TTKU | ||
| N | TyreBrandPreference5 | TyreBrandPreference5 | 10 | All Characters and Special Characters | N | DFGH-TOYU | ||
| O | CustomerReferralLimit | Referral Limit | Referral Limit | 7 | All Characters and Special Characters | N | 300 | 
Importing a file
Preparation
- 
Create a new branch with Jira task number in the branch name
 - 
Delete all the files in importFiles folder
 - 
Create a folder with the current sprint number
 - 
Copy the file that needs to be imported
 - 
Go to
package.json, find the linevalidate:lexSubCustomers - 
Modify
--leaseIdwith the required lease Id - 
Modify
--filewith the relative path of the file - 
Save package.json
 
Validating locally
- 
in a terminal run
npm run build - 
in a terminal run
npm run validate:lexSubCustomers - 
If there are no errors, push the code
 
Validating in workflow
- 
Go to Action of Import-manger
 - 
Find
<Environment> - on-demand-import - 
Select the branch that was created for this import
 - 
Enter script name as
validate:lexSubCustomers - 
Leave Overrides empty
 

Importing the file
- 
If the validation has passed
 - 
Go to Action of Import-manger
 - 
Find
<Environment> - on-demand-import - 
Select the branch that was created for this import
 - 
Enter script name as
import:lexSubCustomers - 
Enter
--persistin Overrides field 


Importing the file via cloud run
Creating Schedulers for validating the lex-sub-customers
- Go to Cloud Scheduler and select the CREATE JOB
 
Setup Required
A Scheduler should be created cloud scheduler with the following parameters
- Name: lex_sub_customer_import_file_validation
 - Region: europe-west2
 - Frequency: 0 0 31 12 1
 - TimeZone: GMT London
 - Target type: HTTP
 - URL: https://import-manager-36r2bu4izq-uc.a.run.app/import-subCustomers
 - HTTP method: POST
 - Auth header: select OIDC token
 - Service account: cloud-run-import-customer-contract
 - body: a JSON object including the following parameters
 
JSON object for lex_sub_customer_import_file_validation scheduler
{
  "leaseId": "QJKgdjS4I02sEia4yTne",
  "leaseCompanyName": "Next Fleet Services",
  "persist": "false",
  "bucket": "biddirect-2.appspot.com",
  "appDirectory": "/usr/src/app/",
  "importPath": "imports/fileDrop/",
  "importFileDropPath": "imports/fileDrop/",
  "importFileName": "lexSubCustomer.csv",
  "email": "mailgun@digitalinnk.com",
  "fatalErrorEmailToAddress": "mailgun@digitalinnk.com",
  "schema": "LEX_SUB_CUSTOMER"
}
Create scheduler for validating the lex-sub-customers



Creating Schedulers for importing the lex-sub-customers
- Go to Cloud Scheduler and select the CREATE JOB
 
Setup Required
A Scheduler should be created cloud scheduler with the following parameters
- Name: lex_sub_customer_file_import
 - Region: europe-west2
 - Frequency: 0 0 31 12 1
 - TimeZone: GMT London
 - Target type: HTTP
 - URL: https://import-manager-36r2bu4izq-uc.a.run.app/import-subCustomers
 - HTTP method: POST
 - Auth header: select OIDC token
 - Service account: cloud-run-import-customer-contract
 - body: a JSON object including the following parameters
 
JSON object for lex_sub_customer_file_import scheduler
{
  "leaseId": "QJKgdjS4I02sEia4yTne",
  "leaseCompanyName": "Next Fleet Services",
  "persist": "true",
  "bucket": "biddirect-2.appspot.com",
  "appDirectory": "/usr/src/app/",
  "importPath": "imports/fileDrop/",
  "importFileDropPath": "imports/fileDrop/",
  "importFileName": "lexSubCustomer.csv",
  "email": "mailgun@digitalinnk.com",
  "fatalErrorEmailToAddress": "mailgun@digitalinnk.com",
  "schema": "LEX_SUB_CUSTOMER"
}
Create scheduler for importing the lex-sub-customers



Preparation:
- Bucket name is biddirect-2.appspot.com and it will vary for higher envs and the file path should imports/fileDrop, where you can drop the CSV file named "lexSubCustomer". This action will place the file in the specified location within the designated bucket.
 

Validation:
- Go to Cloud Scheduler
 - Run lex_sub_customer_import_file_validation job (job name could be different on other env)
 

logs in cloud

Importing:
- Go to Cloud Scheduler
 - Run lex_sub_customer_file_import job (job name could be different on other env)
 

logs in cloud

Testing
- Lex Sub-customers will be created under customer. You can verify this by navigating to the ViSN customer platform and selecting 
Settings > Customers. 
Status: Pending Approval
Category: Protected
Authored By: Harish on March 14, 2024
Revisions