Skip to Content
0

How to use Extension Field in selectionParams

Mar 10, 2017 at 03:55 PM

121

avatar image

Hello Experts,

I've added the extension field ExoToBeSentViaEDI:Indicator to PurchaseOrder object using SDK. I activated the change in ExtPurchaseOrder.xbo object.

Now I would like to be able to query the PurchaseOrder using my new field: ExoToBeSentViaEDI. Unfortunately, the new extension field doesn't show up in the list of available objects which give the possibility to limit the query results:

var query = PurchaseOrder.QueryByElements;

var selectionParams = query.CreateSelectionParams();

selectionParams.Add(query. after ctrl+space I've expected to see my extension field here

,"I","EQ","true");

Do you know what I'm doing wrong?

Or maybe it is just not possible to achieve?

Best Regards

Piotr Kowalski

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Fred K Mar 13, 2017 at 04:50 AM
0

Hi Piotr,

Have a look at this document.

How to add extension fields to standard queries

It said "C4C only" but I think the feature is now available in ByD also.

Best Regards,

Fred

Share
10 |10000 characters needed characters left characters exceeded
Piotr Kowalski Mar 14, 2017 at 10:13 AM
0

Fred, thank you very much again :)

It works indeed.

If you could take a look at one more thing.

Why changing the value of the extended field in ABSL doesn't take effect:

var query = PurchaseOrder.QueryByElements;

var selectionParams = query.CreateSelectionParams();

selectionParams.Add(query.ExoToBeSentViaEDI_BHQ7O8J0U6CKCS20MCR06HO3R,"I","EQ",true);

var resultData = query.Execute(selectionParams);


foreach(var po in resultData){

// the first way I've tried:

po.ExoToBeSentViaEDI = false;

// the second way I've tried:

PurchaseOrder.Retrieve(po.UUID).ExoToBeSentViaEDI = false;

}

Both ways don't make any effect. It means, that the extension field ExoToBeSentViaEDI doesn't change, it still stays as True.

As a complementary information here is how I set the field to True:

I've created BO extension and in Event-BeforeSave event, I've added this code:

import ABSL;

this.ExoToBeSentViaEDI = true;

It just changes the value of ExoToBeSentViaEDI extension field to True whenever the user changes something in the PurchaseOrder.

Is it the possibility to add something like commit/save command for the changes to take effect?

Share
10 |10000 characters needed characters left characters exceeded
Fred K Mar 15, 2017 at 12:58 AM
0

Hi Piotr,

You need to save the current instance to make the changes take effect.

If you are writing your codes in a custom BO Action, you can check "Save After Execution" check box in the event handler on UI.

Best Regards,

Fred

Share
10 |10000 characters needed characters left characters exceeded