Currently I have created three separate job traveler reports that need to be printed based on a PART_UD field that is custom for us. For example if PART_UD (Part.SkidProgram_c) is set to “Skid”. Upon the user selecting to print via a server printer i would expect the BPM to reference the PART_UD field and determine which of the three to printout. Now the question is can you reference a UD table in a BPM?
Yes you can. UD fields exist in your objects you don’t need to reference the UD table for them explicitly. If you are using a data directive you can reference them directly from a data row object. For method directives you have to use brackets on the data row object and use the column name to get the value, you’ll also have to cast it to be the correct type.
foreach(var dataRow in tt{Whatever table})
{
Data Directive:
string s = dataRow.UDFieldName_c;
Method Directive:
string s = dataRow["UDFieldName_c"].ToString();
}
So yes you can indirectly reference the ud tables. However this doesn’t sound like it solved your problem. Are you trying to get data from a specific part record in a bpm?
I did some similar things in a BPM but I was using bartender for printing.
I ended up moving to a customization but it works either way.
I appreciate the input. I have become somewhat familiar with the auto print function in the BPM designer as I have created a few bartender labels and used the condition as to where a label is zero and when the user saves it generates a label automatically. I did find the UD field I described under the part table, but what I am currently stuck on is how to design a BPM that has a two conditions in which the first is:
- Users is in job entry and selects “save” and a auto print action occurs
- During the auto print action another condition is met that says for the PART_UD field if it = field value then choose 1 of the three styles available.
Is that possible to do with the designer? I’m not a programmer and going outside the designer isn’t really an option for me.
I wouldn’t say it’s impossible, but I definitely don’t know how to do it in
the designer. Using a custom code block to do this is pretty
straightforward. Maybe if we gave you a code snippet it would help. I’m not
at a PC at the moment so hopefully someone else is available.
Actually… Now that I’ve had coffee… The part_ud Fields should show up
in the part table, which means you should easily be able to pull that data
using a bpm object to access the part table. I’m sure an example would
help, so stay tuned.
I retract my previous statement. I tried using the Part adapter BO method GetId to return a resultset but it did not include the UD fields.
@Jeremy_Westbrook’s method is the best solution. Once you get the UD field you need, you’ll perform a conditional action (which should be to AutoPrint using a different report style).
With the data directive for “Part” I do see where the UD field is rolled into the part table. Now before my autoprint action for the condition what would I set it as to say if field “skid_program_c” is = to “skid” then print the report style “blah”. I’m guessing the condition before autoprint will have two conditions possibly? Can you specific a condition for when a user selects a print action.
Hi Jeremy, below is what I am trying to achieve:
- User navigates to Job Entry
- User searches for a job # then applies changes to it
- User clicks “save”
- BPM is called and then a condition is referenced as (when the user clicks save the BPM will check a condition that says if “PART_UD.Skig_Program_c” = “Skid” then print the skid report style)
- That way users no longer have to select three of the different report styles and upon the save action it prints the appropriate style
Now whats been confusing me is that from messing with a few data directives iv noticed they are referenced to specific tables and idk if you can branch out to other tables for your conditions. I started off making a directive using JobHead but couldnt figure out how to reference the PART table. So then I created a directive based on PART and found my UD field. But i dont know how to have a condition in the designer that says upon “save” in job entry check PART_UD field. And unfortunately i am not a developer so any type of custom code would be out of my realm unless someone was willing to step me through it.
In all bpms there is a special object called Db. You can use this to query for data outside of the bpm temp tables with linq and entity framework. If you aren’t familiar with those then I’d recommend reading up on them a little. Assuming you already have your job head data row you could do this.
var part = Db.Part.Single(prt => prt.Company == jobHead.Company && prt.PartNum == jobHead.PartNum);
string skidProgram = part["skid_program_c"].ToString();
I’m not familiar with auto print, we use a different system for job travelers. To be honest I’m not sure how much I can help with that part of it. However it sounds like you are trying to run a report. I think in order to accomplish what you want you’d actually need to do a form customization. This way you could add an AfterRowChange event and then call to the JobTravService to run a report. You’d be able to set the report style and run it then it would display on the users machine. If you run it from a bpm it would be run from the users username but it won’t pop up on their machine, meaning you’d either have to email it to them or have them open up the task agent to retrieve it. Form customization’s are quite different from BPM’s but you can do most of the same things only a little differently. I know this is a bit of a change in direction and I’m not sure you want to go that route but I think that will give you the result you want. Let me know if you need more info.