Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This will modify the associations on the key "StandardPriceBook" so t… #127

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions src/commands/texei/data/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,10 @@ export default class Import extends SfCommand<ImportResult> {

// If object is PricebookEntry, look for standard price book
let standardPriceBookId = '';
if (sobjectName === 'PricebookEntry') {
standardPriceBookId = ((await conn.query('Select Id from Pricebook2 where IsStandard = true')).records[0] as any)
.Id;
}

// if (sobjectName === 'PricebookEntry', ) {
standardPriceBookId = ((await conn.query('Select Id from Pricebook2 where IsStandard = true')).records[0] as any).Id;
// }

// Replace data to import with newly generated Record Type Ids
for (const sobject of jsonData) {
// Remove fields that are not on target org if requested
Expand All @@ -223,14 +222,8 @@ export default class Import extends SfCommand<ImportResult> {
// Replace all lookups
for (const lookup of lookups) {
// Regular lookups
if (
sobject[lookup.name] &&
!(
sobjectName === 'PricebookEntry' &&
sobject.Pricebook2Id === 'StandardPriceBook' &&
lookup.name === 'Pricebook2Id'
)
) {
//if (sobject[lookup.name] && !(sobjectName === 'PricebookEntry' && sobject.Pricebook2Id === 'StandardPriceBook' && lookup.name === 'Pricebook2Id'))
if(sobject[lookup.name] && !(sobject.Pricebook2Id === 'StandardPriceBook' && lookup.name === 'Pricebook2Id')) {
sobject[lookup.name] = recordIdsMap.get(sobject[lookup.name]);
}

Expand Down Expand Up @@ -343,7 +336,8 @@ export default class Import extends SfCommand<ImportResult> {
}

// If object is PricebookEntry, use standard price book from target org
if (sobjectName === 'PricebookEntry' && sobject.Pricebook2Id === 'StandardPriceBook') {
//if (sobjectName === 'PricebookEntry' && sobject.Pricebook2Id === 'StandardPriceBook') {
if (sobject.Pricebook2Id === 'StandardPriceBook') {
sobject.Pricebook2Id = standardPriceBookId;
}

Expand Down