cancel
Showing results for 
Search instead for 
Did you mean: 

How to use "Business Configuration Set" in script

sinaei
Contributor
0 Kudos

Hello every one,

I have craeted a Custom Code list and then BCS  that contains, Order Type and Partner Role and Desription.

Here when we want to craete a new salesOrder, we can define a DocumentType. and then chose the Account.

I want to say that if we chose Ho.re.ca. Order DocumentType, in the account we have to chose one of the accounts that has the "Customer" role.

But I do not know in my script how can I say if this.DocumentType = order type of BCS ,...

Can anyone help me with this?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

sumeet_narang
Active Participant
0 Kudos

Hi,

You can do a query by elements on the BCO which will give you the entries available in the BC set.

BCOname.QuerybyElements;

This will give you the list of values maintained in the BC set. You can then compare the document type and proceed further.

Regards,

Sumeet

sinaei
Contributor
0 Kudos

Hello Sumeet,

In my Custom Code List, I have three attribiutes:

but I can not see BPROLE, I will see ID and ORDERTYPE, but not BPROLE.

Do you know why?

Thanks,

Sep

sumeet_narang
Active Participant
0 Kudos

Hi Sep,

This sometimes happens when new fields are added to the BCO later. Can you reactivate the BCO and check. If this doesn't work, try to create a new BCO and see if it works. 

Regards,

Sumeet

Answers (2)

Answers (2)

sunil1101
Advisor
Advisor
0 Kudos

Hi,

As Pradeep suggested you should write logic in Validation-OnSave in of SalesOrder extension.

First you have to define a message in xbo see the below syntax


businessobject SalesOrderXBO raises Invalid_Account {

message Invalid_Account text "For Document type &1 select account Roele as customr" :DocumentTypeCode

In your script you can get help from below code.


if(!this.documentType.IsInitial()){

if( this.documentType.GetDescription() == "HO.re.ca" && qry.CustomerRole != "customer" ){

  raise Invalid_Account.Create("E",this.documentType);

return false;

}

else {

return true;

}

}

Regards

Sunil

sinaei
Contributor
0 Kudos

Hello Sunil and Pradeep,

Thanks for your reply,

Actually I dont want to write it all of the possibilities through code. I want to create a custom code list ( that I have created it)and also the view of my custom code list. I just want to read the data from my custom code list view.

I would be happy if you have any idea.

Thanks

sunil1101
Advisor
Advisor
0 Kudos

Hi

You can use query as sumeet mentioned but you can query on Text node of BCO.

for example

var qrtres = CustomBCO.Text.QueryByElements.Executes();

foreach(var ins in qryres){

var str  = ins.VALUE.content;

}

Regards

Sunil

sinaei
Contributor
0 Kudos

Thanks a lot Sumeet and Sunil,

I have a question, I dont need to query on Text, so I can use QueryByElements.

If I want to say:

if (this.ProcessingTypeCode = BCO_BPROLE_DOCTYPE.DocType)

{

do

},

can you help me with syntax, bexause this syntax is not ok!

Many Thanks

Sep

sinaei
Contributor
0 Kudos

Thanks, It helps me a lot Sunil!

former_member186648
Active Contributor
0 Kudos

Hi,

You could create a extension BO on SalesOrder,

Create Validation-OnSave event on Root and

then check for DocumentType and the selected Account customer role in the event.

Thanks, Pradeep.