# Method Directive BPM won't recognize UD fields

**URL:** <https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638>\
**Category:** Epicor ERP 10\
**Tags:** e10\
**Created:** [February 16, 2021, 5:29pm UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638 "2021-02-16T17:29:22Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samm](https://www.epiusers.help/user_avatar/www.epiusers.help/samm/32/11072_2.png) [@Samm](https://www.epiusers.help/u/Samm)\
**Post date:** [February 16, 2021, 5:29pm UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/1 "2021-02-16T17:29:22Z")

</div>

Does anyone now why I am not able to access the custom fields? Obviously the BPM is not complete, but I am just trying to see why I cannot have access to the special fields?

 ![1](https://www.epiusers.help/uploads/default/original/3X/9/c/9c00413110d5336347fce530f0b13b6fb7367a5c.png)

![2](https://www.epiusers.help/uploads/default/original/3X/b/6/b6820a0eb7ca7d116044398dfab0d580900d50ac.png)

---

<div class="post-metadata">

**Author:** ![Jason\_Woods](https://www.epiusers.help/user_avatar/www.epiusers.help/jason_woods/32/80101_2.png) [@Jason\_Woods](https://www.epiusers.help/u/Jason_Woods)\
**Post date:** [February 16, 2021, 5:33pm UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/2 "2021-02-16T17:33:16Z")

</div>

Your datamodel may not be in sync then. Try regenerating the datamodel.

---

<div class="post-metadata">

**Author:** ![Samm](https://www.epiusers.help/user_avatar/www.epiusers.help/samm/32/11072_2.png) [@Samm](https://www.epiusers.help/u/Samm)\
**Post date:** [February 16, 2021, 5:33pm UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/3 "2021-02-16T17:33:49Z")

</div>

This is an old field from years ago. And I double checked and datamodel is synced.

---

<div class="post-metadata">

**Author:** ![Jason\_Woods](https://www.epiusers.help/user_avatar/www.epiusers.help/jason_woods/32/80101_2.png) [@Jason\_Woods](https://www.epiusers.help/u/Jason_Woods)\
**Post date:** [February 16, 2021, 5:40pm UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/4 "2021-02-16T17:40:13Z")

</div>

In what way is it “not recognized “ then?

Jason Woods  
[http://LinkedIn.com/in/jasoncwoods](http://LinkedIn.com/in/jasoncwoods)

---

<div class="post-metadata">

**Author:** ![Samm](https://www.epiusers.help/user_avatar/www.epiusers.help/samm/32/11072_2.png) [@Samm](https://www.epiusers.help/u/Samm)\
**Post date:** [February 16, 2021, 5:44pm UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/5 "2021-02-16T17:44:51Z")

</div>

I have added two screenshots, on the first one as you can see it gives me an error not recognizing the custom field.

---

<div class="post-metadata">

**Author:** ![Jason\_Woods](https://www.epiusers.help/user_avatar/www.epiusers.help/jason_woods/32/80101_2.png) [@Jason\_Woods](https://www.epiusers.help/u/Jason_Woods)\
**Post date:** [February 16, 2021, 5:49pm UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/6 "2021-02-16T17:49:50Z")

</div>

Try:  
orderHedRow[“SpecialProjectName\_c”]

Jason Woods  
[http://LinkedIn.com/in/jasoncwoods](http://LinkedIn.com/in/jasoncwoods)

---

<div class="post-metadata">

**Author:** ![adaniell](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/278dde/32.png) [@adaniell](https://www.epiusers.help/u/adaniell)\
**Post date:** [February 16, 2021, 5:56pm UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/7 "2021-02-16T17:56:57Z")

</div>

Try using the following methods to get/set UDFs when dealing with temp tables:

```auto
string projectName = orderHedRow.UDField<String>("SpecialProjectName_c");

```

Change the type if SpecialProjectName\_c is not a string.

To set it…

```auto
 orderHedRow.SetUDField<string>("SpecialProjectName_c", "New special project name");

```

---

<div class="post-metadata">

**Author:** ![Samm](https://www.epiusers.help/user_avatar/www.epiusers.help/samm/32/11072_2.png) [@Samm](https://www.epiusers.help/u/Samm)\
**Post date:** [February 16, 2021, 6:14pm UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/8 "2021-02-16T18:14:42Z")

</div>

Yes it worked! Thank you!!

But when you try, do you see the custom fields in a normal way without using brackets? Like orderhedRow.CustomFieldHere

We are using version 10.2.300.41.

---

<div class="post-metadata">

**Author:** ![Jason\_Woods](https://www.epiusers.help/user_avatar/www.epiusers.help/jason_woods/32/80101_2.png) [@Jason\_Woods](https://www.epiusers.help/u/Jason_Woods)\
**Post date:** [February 16, 2021, 6:17pm UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/9 "2021-02-16T18:17:38Z")

</div>

> [@Samm](#):
>
> But when you try, do you see the custom fields in a normal way without using brackets? Like orderhedRow.CustomFieldHere

Not in a method directive. Only Data Directives.

---

<div class="post-metadata">

**Author:** ![Samm](https://www.epiusers.help/user_avatar/www.epiusers.help/samm/32/11072_2.png) [@Samm](https://www.epiusers.help/u/Samm)\
**Post date:** [February 16, 2021, 6:31pm UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/10 "2021-02-16T18:31:45Z")

</div>

Thanks again for your help!

---

<div class="post-metadata">

**Author:** ![SAD](https://www.epiusers.help/user_avatar/www.epiusers.help/sad/32/22683_2.png) [@SAD](https://www.epiusers.help/u/SAD)\
**Post date:** [February 17, 2021, 5:32pm UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/11 "2021-02-17T17:32:52Z")

</div>

When you add UD field and regen DB model, then only EF entities are extended. As a result, if you use a parameter table of data directive or properties of DB context entry (e.g. this.Db.Tip.Field) then real .NET property is available.

Method directives operate on tablesets. ERP does not change them, since there is no way to synchronize such changes between server and client. So, UD fields (and Extension Peer fields) are available only as an “extended” properties on table row.

To make access typed, BPM provides UDField and SetUDField extension methods for tableset rows mentioned in this thread…

---

<div class="post-metadata">

**Author:** ![SAD](https://www.epiusers.help/user_avatar/www.epiusers.help/sad/32/22683_2.png) [@SAD](https://www.epiusers.help/u/SAD)\
**Post date:** [February 17, 2021, 5:36pm UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/12 "2021-02-17T17:36:24Z")

</div>

> [@Jason\_Woods](#):
>
> Try:  
> orderHedRow[“SpecialProjectName\_c”]
> 
> Jason Woods  
> [Jason Woods - Jason Woods Consulting | LinkedIn](http://LinkedIn.com/in/jasoncwoods)

I strictly not recommend to use this syntax. It does not check types. UDField and SetUDFiled methods should be used.

---

<div class="post-metadata">

**Author:** ![Jason\_Woods](https://www.epiusers.help/user_avatar/www.epiusers.help/jason_woods/32/80101_2.png) [@Jason\_Woods](https://www.epiusers.help/u/Jason_Woods)\
**Post date:** [February 17, 2021, 5:44pm UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/13 "2021-02-17T17:44:46Z")

</div>

> [@SAD](#):
>
> strictly not recommend to use this syntax

I suppose this is technically correct, but you could always force the type too. I’ve written hundreds if not thousands of BPMs like I showed without issues though.

---

<div class="post-metadata">

**Author:** ![SAD](https://www.epiusers.help/user_avatar/www.epiusers.help/sad/32/22683_2.png) [@SAD](https://www.epiusers.help/u/SAD)\
**Post date:** [February 18, 2021, 8:01am UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/14 "2021-02-18T08:01:16Z")

</div>

Definitely, I cannot prevent you from doing that. I just explained how it was designed to be used… starting 10.0.

---

<div class="post-metadata">

**Author:** ![AndrewM](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/c57346/32.png) [@AndrewM](https://www.epiusers.help/u/AndrewM)\
**Post date:** [February 18, 2021, 11:36pm UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/15 "2021-02-18T23:36:51Z")

</div>

@SAD - Sorry if this question is something I should know, but aren’t you having to cast the type of the custom field when using the UDField method anyway. So casting the wrong type in either case will cause runtime errors? I’m just trying to work out the benefit since I’ve been using what was suggested by @Jason_Woods up until now.

---

<div class="post-metadata">

**Author:** ![SAD](https://www.epiusers.help/user_avatar/www.epiusers.help/sad/32/22683_2.png) [@SAD](https://www.epiusers.help/u/SAD)\
**Post date:** [February 19, 2021, 6:20am UTC](https://www.epiusers.help/t/method-directive-bpm-wont-recognize-ud-fields/75638/16 "2021-02-19T06:20:03Z")

</div>

When a typed method is used, it checks that a value that your providing has a compatible type at design time. So it protects you from mistakes (e.g. you use a variable or another field with a wrong type or type of this variable/field has been changed after the moment when you created the directive).

In general. typed accessors minimize (not avoid) the possibility of miscasting.
