K2: Smartforms - List Smartobject with Multiple Values for Associations

  • 26 September 2018
  • 1 reply
  • 33 views

I have 2 different smartobjects which I would like to use for emailing purposes. One for customer, and one for recipients, where the recipients smartobject has: RecipientID, RecipientName, EmailAddress and CustomerID (Foreign Key). Customer is CustomerID, CustomerName.
In my smartform I'm using a multiselect on the Customer SmartObject which looks at the CustomerName and returns the CustomerID.
I want this to then populate another multiselect to return all Recipients that are associated to the CustomerID's returned in the first multiselect.
However, when doing this with more than one customer, I'm unable to populate the Recipient List as I get an error because of the ; delimited list selected in the first part is seen as an nvarchar and not an int.

 

I'm currently using a work around which isn't best practice with relational databases, I'm using one large smartobject consisting of the CustomerID, CustomerName, Email Addresses. The email addresses field consists of a large list of all the recipients associated to the customer which is saved as a memo field in the smartobject. I can then return all the email addresses associated to the customer but unable to edit an individual recipient as they are part of the long list.  

 

Does anyone have a work around for the initial issue?


1 reply

Badge +7

Hi AaronGS,


 


Thanks for asking this question here on the community forum. I realize it's been a while since you asked this question, but I guess the community was pretty stumped with the question you asked.


 


Did you manage to resolve your issue in the meantime by other means?


 


If not, then in order to help you here, I'd just like to get some clarity on the issue you describe. So you have a table called "Recipients" in a database with the following columns:


 


RecipientID


RecipientName


EmailAddress


CustomerID (which has a Foreign Key constraint).


 


Then you have another table called "Customer" with the following rows:


 


CustomerID


CustomerName


 


Now you've created two SmartObjects from those two tables, and using two Multiselect Controls on a SmartForm, you're trying to do a many-to-many selection of various entries in those two tables to finally get at a result and when you click a button, it should send an email to those results. Am I sort of explaining here what you're trying to do?


 


Many-to-many relations are notoriously difficult to implement in K2, because there are certain limitations placed on how we can do this. I would need to know which version of K2 you are using, and if you're using K2 Designer or K2 Studio / K2 for Visual Studio to create (and deploy) these SmartObjects.


 


Maybe it would help if you add some screenshots to this post so we have a visual representation of what you're trying to do.


 


Kind regards,


ChrisW

Reply