cancel
Showing results for 
Search instead for 
Did you mean: 

C4C: PDI - Advanced List Pane - issue with data retrieve / query

TomK
Advisor
Advisor
0 Kudos

Hi Experts,

I would like to show a list of extended Opportunity Objects in a Custom-BOs TI-Screen. To achieve this I added an Advanced List Pane on my TI screen of the Custom BO.

Furthermore I realized the [0,n] association via in my Custom BO:

...

node OpportunityNode [0,n] {

element ItemID:ID;

association ToOppyNode to Opportunity;

}

...

My target is to fill to fill the Advanced List Pane based on an extension field on the Opportunity. I am not sure what the best way would be to realize this. Here my first approach and the disadvantages I faced with it. Maybe you can tell me, what to adjust or make totally different.

First Approach:

In a first approach/test I added an EventHandler (fired via on-click on the tab in the TI), which calls an Action that retrieves some Opportunities based on their ID (see attached Screenshot).

Disadvanteges / Issues:

As a result I can see in the debugging, that the opportunities are retrieved correctly, but only one row is shown in the Advanced List Pane. Additionally the UI switches into edit mode, even if I just want to display some opportunities. To realize the retrieve, based on my extension field on the Oppy I guess I would need to create a new retrieve method for the opportunity.

At this point I think, the way I took is maybe not the best/correct one. I am even not sure, if it is really required to add the [0,n] relation to my Custom BO because I saw the possibility on the TI screen to add Queries and fill DataLists with it. Is this maybe the solution I am looking for? Unfortunately I cannot find documentation on this in the PDI1405 Guide.

Can you give me an advice how to proceed best for this requirement?

Thanks and best regards

Tom

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Tom, can you please post a screenshot of the binding of your listpane?

Is your OpportunityNode filled with all the required instances?

TomK
Advisor
Advisor
0 Kudos

Hi Alessandro,

thanks for having a look at it.

Here the binding:

Here the action that I defined:

import ABSL;
import AP.Common.GDT;
import AP.CRM.Global;

var opportunityCollection;

var elementID : Opportunity.ID;
var collectionID : collectionof Opportunity.ID;

elementID.content = "1";
collectionID.Add(elementID);
elementID.content = "11";
collectionID.Add(elementID);

opportunityCollection = Opportunity.Retrieve(collectionID);

//Delete previous entries

this.OpportunityNode.Delete();

//Fill oppyItem nodes with data


var i = 0;

foreach (var oppy in opportunityCollection){

var itemData = this.OpportunityNode.Create();
itemData.ItemID = i.ToString();
i = i + 1;
itemData.ToOppyNode = oppy;

}

I guess to do the fetch based on my extension field on the Opportunity BO I would need to do a query instead of a Retrieve (this was just a first try to get data into the list pane).

In debugging I can see, that the two Oppys are delivered by the Retrieve. But I don't know where to see if all instances are finally added as a node.

Best regards

Tom

Former Member
0 Kudos

Check that the datalist is binded with the opportunitynode and not with the association.

To see if all the instances are added you can declare a temp variable like this:

var test = this.OpportunityNode;

[next steps]

and check the test value in debug mode

TomK
Advisor
Advisor
0 Kudos

Now we can see all the retrieved or queried oppys. Thanks for the databinding hint. We binded the node now to the datalist-root.

But we struggle with querying via our extension-field on the Opportunity.

Following examples works based on Oppy-ID.

var query = Opportunity.QueryByElements;  

var oppyID1 = "1";
var oppyID2 = "11";
var oppyID3 = "18";
var selectionParams = query.CreateSelectionParams();
selectionParams.Add(query.ID.content, "I", "EQ", oppyID1);

selectionParams.Add(query.ID.content, "I", "EQ", oppyID3);

selectionParams.Add(query.ID.content, "I", "EQ", oppyID3);
var resultData = query.Execute(selectionParams);

________

Query based on Extension Field does not work.

var query = Opportunity.QueryByElements;  

var extBOID= "1000004";

var selectionParams = query.CreateSelectionParams();
selectionParams.Add(query.ExtBOID.content, "I", "EQ", extBOID);
var resultData = query.Execute(selectionParams);

Error: Identifier 'ExtBOID' does not exist.

Question:

I added the element via ExtOppportunity to the standard BO and I also see the field available when debugging the query based on Oppy-ID. Do I need to add the ExtBOID element somehow as an Identifier to make it available as a query-parameter? How do I do that?

Thanks for your help and best regards

Tom


Former Member
0 Kudos

Try this: right click on your bo extension and then...

Alternatively, quey all the opportunities and then loop and filter manually.

TomK
Advisor
Advisor
0 Kudos

Hi Allessandro,

thanks for your ideas.

I now managed to fullfill the requirement in another way. Via the Create / Edit on the Oppy I added the CustomBO-ID via an Extension-Field and addtionally in the BeforeSave-Event of the Oppy I assigned the Oppy to the Oppportunity-Node of my CustomBO.

With the Data Binding on the Data-List-Root to the Opportunity-Node (thanks for that hint!) the opportunities are now correctly shown in the list.

Thanks for your hints and ideas.

Best regards

Tom

Answers (1)

Answers (1)

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Tom,

Maybe this How-To from gives you a help.

Bye,

  Horst