I’m still working with hacking my way through C#. The latest stumbling block is adding an organization with an associated parent organization. The end result would look like the following within RightNow:
To date, I have the following code using the RNOW Data Connection API
// set parent org
if (Convert.ToString(row) != "")
int z = getXrefId(Convert.ToString(row), tblXrefIds);
if (z != 0)
RNOWOrganization parentOrg = new RNOWOrganization(z);
List parentOrgs = new List();
myOrg.Parent = parentOrgs;
The current question? The code syntax
'myOrg.Parent = parentOrgs;' doesn’t work. Instead, I get the error:
Cannot implicitly convert type ‘System.Collections.Generic.List<int>’ to ‘System.Collections.Generic.List<int?>’
Seems same to me.
Argh!!! Why can it just be a single Integer representing the ID of the organization. A list to set a single parent? What for? Make it simple stupid. The head scratching continues.
Turns out C# provides a way to define a nullable list of collections. This is defined by the ‘?’ notation. So, parentOrgs in the code snippet above had to be defined by:
List<int?> parentOrgs = new List<int?>();
Defining the hierarchy is still not working 100%, but this hurdle is hopped over.