Skip to content

Instantly share code, notes, and snippets.

@beauraines
Created January 16, 2019 00:49
Show Gist options
  • Save beauraines/d98d65357d421d79506431745244c62b to your computer and use it in GitHub Desktop.
Save beauraines/d98d65357d421d79506431745244c62b to your computer and use it in GitHub Desktop.
Adding firm production plan in workflow fails on the last line TypeError: Cannot read property 'push' of undefined
function sendAddProductionPlan() {
// Set required arguments
scope.activatedProductionPlan.bomID = null;
scope.activatedProductionPlan.type = 'USER-CREATED';
// remap values
scope.activatedProductionPlan.dueDate = scope.activatedProductionPlan.due_date;
if ( scope.firmPlanOnly) {
scope.activatedProductionPlan.firmFlag = 1;
} else {
if (scope.activatedProductionPlan.firm_flag) {
scope.activatedProductionPlan.firmFlag = scope.activatedProductionPlan.firm_flag;
} else {
scope.activatedProductionPlan.firmFlag = 0;
}
}
if (scope.addOrEdit === 'add') {
// TODO: flash not working here after addition made
dataFactory.addProductionPlan(scope.activatedProductionPlan)
.success(function(data, status) {
// Need to check for status 304 here because the controller always returns a 200
if (data.status != 304 ) {
scope.planningData.push(data.object);
@beauraines
Copy link
Author

scope.planningData is undefined!! Why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment