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

import: assignment rule #29

Merged
merged 1 commit into from
Mar 22, 2024
Merged
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
21 changes: 20 additions & 1 deletion addon/data-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Model {
this.confirmPopup = null;
this.activeBatches = 0;
this.isProcessingQueue = false;
this.assignmentRule = false;
this.importState = null;
this.showStatus = {
Queued: true,
Expand Down Expand Up @@ -833,7 +834,11 @@ class Model {
setTimeout(this.executeBatch.bind(this), 2500);

let wsdl = sfConn.wsdl(apiVersion, this.apiType);
this.spinFor(sfConn.soap(wsdl, importAction, importArgs).then(res => {
let soapheaders = {};
if (this.assignmentRule && (this.importType === "Case" || this.importType === "Lead" || this.importType === "Account")) {
soapheaders.headers = {"AssignmentRuleHeader": {"useDefaultRule": true}};
}
this.spinFor(sfConn.soap(wsdl, importAction, importArgs, soapheaders).then(res => {

let results = sfConn.asArray(res);
for (let i = 0; i < results.length; i++) {
Expand Down Expand Up @@ -909,6 +914,7 @@ class App extends React.Component {
this.onDataPaste = this.onDataPaste.bind(this);
this.onExternalIdChange = this.onExternalIdChange.bind(this);
this.onBatchSizeChange = this.onBatchSizeChange.bind(this);
this.onAssignmentRuleChange = this.onAssignmentRuleChange.bind(this);
this.onBatchConcurrencyChange = this.onBatchConcurrencyChange.bind(this);
this.onToggleHelpClick = this.onToggleHelpClick.bind(this);
this.onDoImportClick = this.onDoImportClick.bind(this);
Expand Down Expand Up @@ -969,6 +975,11 @@ class App extends React.Component {
model.executeBatch();
model.didUpdate();
}
onAssignmentRuleChange(e) {
let {model} = this.props;
model.assignmentRule = e.target.checked;
model.didUpdate();
}
onBatchConcurrencyChange(e) {
let {model} = this.props;
model.batchConcurrency = e.target.value;
Expand Down Expand Up @@ -1187,6 +1198,14 @@ class App extends React.Component {
)
)
),
h("div", {className: "conf-line", hidden: (model.importType != "Case" && model.importType != "Lead" && model.importType != "Account")},
h("label", {className: "conf-input", title: "Uses the default (active) assignment rule for a Case or Lead. If true for an Account, all territory assignment rules are applied. If false for an Account, no territory assignment rules are applied."},
h("span", {className: "conf-label"}, "Assignment rule"),
h("span", {className: "conf-value"},
h("input", {type: "checkbox", checked: model.assignmentRule, onChange: this.onAssignmentRuleChange})
)
)
),
h("datalist", {id: "sobjectlist"}, model.sobjectList().map(data => h("option", {key: data, value: data}))),
h("datalist", {id: "idlookuplist"}, model.idLookupList().map(data => h("option", {key: data, value: data}))),
h("datalist", {id: "columnlist"}, model.columnList().map(data => h("option", {key: data, value: data})))
Expand Down