07-10-2014 07:44 AM - edited 07-10-2014 08:57 AM
I have created my own custom sub entity in the past and was able to bind the fields to my Winform controls all of the code I showed below is similar to how I did this and it worked great. (I was able to use aliases instead of realnames).
Now I am trying to do the same but for our Opportunity Products.
I am able to list all of the Opportunity Products in a datagridview without issue (unfortunatley can't use field alais for some reason).
My issue is that when I try to bind one of the fields to say a textbox control. I get an exception error saying:
Invalid name format: (the column name I passed in - tried alias, table.columnname , columnname)
Parameter name: realName
I can't figure out why this won't work. If anyone could chime in on this it would be greatly appreciated as I've wasted a good few hours on this now. Hoping that I don't have to create a whole new custom sub entity to achieve this as all of this worked fine on a normal created custom sub entity.
Thanks in advance for any help!
//CustomSubEntityManager<OpportunityProduct> manager = actFwk.Products.OpportunityProductManager;
CustomEntityDescriptor descriptor = actFwk.CustomEntities.GetEntityDescriptor("PRODUCT_SERVICE");
CustomSubEntityManager<OpportunityProduct> manager = actFwk.CustomEntities.GetSubEntityManager<OpportunityProduct>(descriptor);
if (manager != null)
// Get all the Products for the Current Opportunity.
CustomEntityList<OpportunityProduct> oppProducts = tool.getOpportunityProducts(opp);
if (oppProducts != null)
string fieldName = "TBL_PRODUCTSERVICE.CUST_associatedContact_093035503"
// Set the data source of the binding source to be the list of doctorFees.
bindingSource1 = new BindingSource();
bindingSource1.DataSource = oppProducts;
// Databind the grid to the list of doctorFees.
this.dataGridView1.DataSource = bindingSource1;
textBox1.DataBindings.Add("Text", bindingSource1, "CUST_associatedContact_093035503", false);
07-10-2014 07:59 AM
Have you tried the ACTDataMemberField instead of "CUST_associatedContact_093035503"?
It has been a while since I wrote our binding manager code but here is a wuick example:
Control.DataBindings.Add((New Windows.Forms.Binding(ACTPropertyName, Me.EntityBindingSource, ACTDataMemberField, False, DataSourceUpdateMode.OnValidation)))
-- Jim Durkin
07-10-2014 12:47 PM
I will just keep a reference to the current product something like this:
OpportunityProduct currentProd = oppProducts;
this.textBox1.Text = getFieldDescriptorByDisplayName("Associated Contact", manager).GetValue(oppProducts).ToString();
It's a work around but hopefully it won't cause me too many issues.
07-15-2014 05:58 AM
Hey Jim, thanks I haven't tried that yet but I certainly will!
Your reply post didn't show up the day I posted the first message for some reason altough I get the email saying you replied.
I see your post now so I will certainly try that out.
Thanks again for the help!