Im after some help with BPM’s - Ive not done a great deal with them but hoping to expand on my knowledge in this area.
I have a requirement that when clicking a new button on the Sales order line- it mass updates all lines on the order by setting one boolean field to true, 2nd boolean field to false, and also requests a date to
be entered which user inputs and it sets that on ever line also.
@carlawhite This is possible and not too difficult assuming all of the fields are UD fields. Since this effects all lines a simpler approach not requiring any custom coding would be to make a tab on the header panel and put the two bools and the date there. Then on SalesOrder.Update preprocessing check for that checkbox changing and require the date. Then post processing update all of the lines to match the header fields.
As Greg mentioned, and you probably already know, the complexity of this requirement depends on what the boolean and date fields are. What are the fields in question? Do you want them to update when the button is clicked or when a new line is added?
Is the date field also a UD field on each line?
Is the date field one of the system order line dates?(e.g. OrderDtl.NeedByDate) If it is a system field, there are some things to consider and you will want to use business objects to update the fields.
Either way, this is possible and not too bad to implement. Are you comfortable implementing this in a custom code block, in a BPM?
And this should only happen on a button click?
In that case, you could consider implementing this entirely in a customization.
Or you could set a call context variable in the customization to indicate your custom process should execute, and call Update in the customization, when users click the button. Have a BPM on Update, or similar method, where your custom process executes. Then clear the call context variable.
I added a field and a button to the Summary sheet on the Order Entry form, to allow the users to automatically update the Ship From on the OrderRel lines.
The user selects the desired warehouse from the drop down (which in your case would be a date control for the desired Promise by date). Then clicks the button.
Here’s the code for the button click.
Variable bcmbSiteWhse is the control that holds the site and warehouse. Because I need to set the site and warehouse it’s a combo of the two with a ~ separating them. You won’t need to do all that. Just get the date from your control.
my dataview is on the OrderRel, you’ll want to use the OrderDtl.
the lines between relLine.BeginEdit(); and relLine.EndEdit(); are the ones that update the values on the form. This is where your updates go.
private void btnFromChal_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
if((string)bcmbSiteWhse.Text == ""){
return;
}
string newSite= ((string)bcmbSiteWhse.Value).Split(new Char [] {'~'})[0];
string newWhse= ((string)bcmbSiteWhse.Value).Split(new Char [] {'~'})[1];
//MessageBox.Show("Plant:" + newSite +"\nWhse: "+newWhse);
DialogResult result1 = MessageBox.Show("Are you sure you want to set all open releases to ship from:\n" + (string)bcmbSiteWhse.Text, "Mass Change Ship From", MessageBoxButtons.YesNo);
if (result1 == DialogResult.Yes){
EpiDataView orderRel = (EpiDataView)(oTrans.EpiDataViews["OrderRel"]); // We will need the order release view
int releaseCounter = 0;
foreach (DataRow relLine in orderRel.dataView.Table.Rows){
if ((bool)relLine["OpenRelease"] == true){ // && (string)relLine["Plant"] != currSite && (string)relLine["WarehouseCode"] != currWhse){
relLine.BeginEdit();
relLine["Plant"] = newSite;
relLine["WarehouseCode"] = newWhse;
relLine.EndEdit();
releaseCounter++;
}
}
oTrans.NotifyAll();
MessageBox.Show(releaseCounter.ToString() + " Releases updated.\n\n Don't forget to save!");
}
}
Note that this requires no BPM’s. I mention that because it sounds like you’re using BPM’s to do the updates, and they would fight with this customization code.