diff --git a/consumer/README.md b/consumer/README.md index a6b128c..214edd3 100644 --- a/consumer/README.md +++ b/consumer/README.md @@ -182,6 +182,7 @@ Use following JSON for testing "code": "123" } }, + "directProjectId": 5001, "cancelReason":null, "members": [ { @@ -203,6 +204,7 @@ Use following JSON for testing "updated": { "id": 1, "status": "active", + "directProjectId": 6001, "cancelReason": "Spam", "details": { "utm": { diff --git a/consumer/src/services/ConsumerService.js b/consumer/src/services/ConsumerService.js index 2ff1959..8371ccd 100644 --- a/consumer/src/services/ConsumerService.js +++ b/consumer/src/services/ConsumerService.js @@ -48,6 +48,9 @@ function getUpdatedLeadFieldData(projectUpdated) { if (projectUpdated.details) { updatedLead.Ref_Code__c = _.get(projectUpdated,"details.utm.code", ""); } + if (projectUpdated.directProjectId) { + updatedLead.TC_Connect_Direct_Project_Id__c = _.get(projectUpdated, "directProjectId",""); + } return updatedLead; } @@ -86,6 +89,7 @@ class ConsumerService { TC_Connect_Project_Id__c: project.id, TC_Connect_Project_Status__c: _.get(project,"status",""), Ref_Code__c: _.get(project, "details.utm.code",""), + TC_Connect_Direct_Project_Id__c: _.get(project, "directProjectId",""), TC_Connect_Cancel_Reason__c: _.get(project,"cancelReason","") }; return SalesforceService.createObject('Lead', lead, accessToken, instanceUrl) diff --git a/consumer/test/ConsumerService.spec.js b/consumer/test/ConsumerService.spec.js index a595cc0..195c7e8 100644 --- a/consumer/test/ConsumerService.spec.js +++ b/consumer/test/ConsumerService.spec.js @@ -83,7 +83,8 @@ describe('ConsumerService', () => { TC_Connect_Project_Id__c: 1, Ref_Code__c: '123', TC_Connect_Project_Status__c: '', - TC_Connect_Cancel_Reason__c: null + TC_Connect_Cancel_Reason__c: null, + TC_Connect_Direct_Project_Id__c: '' }; const expectedCampaignMember = {