Insert records into a UD table

Since the Customer Price list does not have an Audit/Charge log, I am attempting to create one via BPM.

I search this forum for into -

It one BPM it has:

/* Find current record in dataset */
using (var txScope = IceContext.CreateDefaultTransactionScope())

The other I looked at has:

using(var UD02svc = Ice.Assemblies.ServiceRenderer.GetService(Db))
{

which is correct - also how is var defined?

Any help would be appreciated.

var UD02svc = Ice.Assemblies.ServiceRenderer.GetService(Db);
string custNum = ctr.CustNum.ToString();
UD02Tableset ds = new UD02Tableset();
var udRow = (from ud02 in Db.UD02 where ud02.Company == ctr.Company && ud02.Key1 == table && ud02.Key2 == action && ud02.Key3 == custNum select ud02).FirstOrDefault();
if (udRow == null)
{
UD02svc.GetaNewUD02(ref ds);
ds.UD02[0].Key1 = table;
ds.UD02[0].Key2 = action;
ds.UD02[0].Key3 = custNum;
UD02svc.Update(ref ds);
}

@T11 this is what you were looking for as well. I have also had success adding ChangeLog records the native way. I did this for Employee Entry

2 Likes

Thanks!!

I must be doing something wrong - under actions in the BPM - I usually choose execute ABL code - it doesn’t like this -

var UD02svc = Ice.Assemblies.ServiceRenderer.GetService(Db);

There is a nice example here.

I am definitely not understanding.

I created a Data Directive on PLParkBrk where the rowmod = A, U and D.

What is the syntax to access table UD02.

Cathy,
You posted this question in E9, is that the version you are looking to do this BPM in? I see a lot of people throwing C# at you (shame on you people - you know who you are lol) you should be looking for ABL or 4GL examples of which there should be more than a few on here.

here is the ABL to create a UD02

			Create UD02.
			
			Assign	UD02.key1	= key1
							UD02.key2	= ""
							UD02.key3	= ""
							UD02.key4	= ""
							UD02.key5	= ""
							UD02.Company = cur-comp.


			Assign	UD02.ShortChar01	=	""
					UD02.Number01			=	0.0 .


		Release UD02.
		

1 Like

I was waiting for you to step in @gpayne :slight_smile:

@rbucek Yep I feel like the last of the ABL coders. Hopefully after Insights I will get a chance to jump into E10 coding.

Awesome, we’re all here for you if you need us. You certainly have provided a ton of guidance for us over the years in ABL.

1 Like

@gpayne

I attempted to use your code to create a E9 BPM. The BPM validates. It triggers. I have a notification message to tell me so. But then it never created the UD record. What could be preventing this from working?

@Carl_Gansen If you can post your code we can look. At least one key has to have a value and all 5 have to be set.
Do you have your appserver in verbose so you can look for messages there?

I figured it out. I had another piece of code that was throwing a hidden error and preventing your code from running.