Hi,
I am trying to add a Buyer using the following code but get 'Cannot access Member' in the line allBuyers.Add(newBuyer);
IList allBuyers = (IList)newOrder["Buyers"];
IOrderItem newBuyer;
if (allBuyers == null || allBuyers.Count == 0)
{
newBuyer = newOrder.CreateNew("Buyer");
allBuyers.Add(newBuyer); //error here 'Cannot access Member'
}
newBuyer = (IOrderItem)allBuyers[0];
newBuyer["Name"] = "XXXXXX";
newBuyer["Code"] = "B";
I tried to create a seller a little different using dynamics and have face same issue
dynamic o = (dynamic)newOrder;
dynamic seller = ((IOrder)o).CreateNew("Seller");
dynamic indv = seller.Individual1;
indv.FirstName = "fname";
indv.LastName = "Lname";
dynamic sellers = o.Sellers;
sellers.Add(seller); //error here 'Cannot access Member'
I have verified all permissions for the user and given every permission possible but still no luck.
Please advice.
Thanks.
Cannot Access Member
-
- Posts: 1381
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Cannot Access Member
Add all contacts to the Contacts collection.
Code: Select all
// Create specific Contact type and populate item.
dynamic listingAgent = ((IOrder)_order).CreateNew("ListingAgentBroker");
...
// Save by adding to Contact list.
dynamic contacts = ((IOrder)_order)["Contacts"];
contacts.Add(listingAgent);
Bob Richards, Senior Software Developer, SoftPro
Re: Cannot Access Member
Thank you Bob, that worked!
I am having same 'Cannot access member' issue when I am trying to add new task, I tried the following code
dynamic newtask = order.CreateNew("RequestedTask");
newtask.Description = "Title Update";
newtask.Status = TaskStatusType.Requested;
newtask.RequestedDate = DateTime.Now.AddDays(1);
dynamic requestedTasks = order["RequestedTasks"];
requestedTasks.Add(newtask); //error 'Cannot access member' in this line
Any suggestions?
Thanks.
I am having same 'Cannot access member' issue when I am trying to add new task, I tried the following code
dynamic newtask = order.CreateNew("RequestedTask");
newtask.Description = "Title Update";
newtask.Status = TaskStatusType.Requested;
newtask.RequestedDate = DateTime.Now.AddDays(1);
dynamic requestedTasks = order["RequestedTasks"];
requestedTasks.Add(newtask); //error 'Cannot access member' in this line
Any suggestions?
Thanks.
-
- Posts: 1381
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Cannot Access Member
Try adding requested tasks to the Tasks collection.
Code: Select all
dynamic tasks = order["Tasks"];
tasks.Add(newtask);
Bob Richards, Senior Software Developer, SoftPro
Re: Cannot Access Member
Hi Bob,
I tried that and get the same error.
thanks
I tried that and get the same error.
thanks
Re: Cannot Access Member
Hi,
The following code works if I try to add task while creating a new order, but get 'Cannot access member' error when I open an existing order and try to add a RequestedTask to it. We have been doing this in the older version (v2.6), is it possible in v3.0 and above?
dynamic tasks = order["Tasks"];
tasks.Add(newtask);
thanks
The following code works if I try to add task while creating a new order, but get 'Cannot access member' error when I open an existing order and try to add a RequestedTask to it. We have been doing this in the older version (v2.6), is it possible in v3.0 and above?
dynamic tasks = order["Tasks"];
tasks.Add(newtask);
thanks