Skip to main content
Nintex Community Menu Bar
Solved

How do I add OTHER to a dropdown list populated through a smart object linked to a database table?


Forum|alt.badge.img+2

I have a dropdown list that is populated by a smart object that retrieves a list from a table in a database. It works and displays all the information as it should, but I want to add one more item that reads OTHER at the end of the list (preferably). I am trying to not make a static list, instead displaying a mildly dynamic dropdown list. Does anyone know how to do that?

 

Also, I’m avoiding adding anything to the table because other apps probably use that table, too.

 

Best answer by tbyrne777

A bit of a work-around, but you could use a stored procedure to return all of the contents of this table and append “other” to it in there. Then use this stored procedure as the source of your dropdown.

View original
Translate
Did this topic help you find an answer to your question?

15 replies

Forum|alt.badge.img+13
  • Scholar
  • 499 replies
  • Answer
  • January 22, 2025

A bit of a work-around, but you could use a stored procedure to return all of the contents of this table and append “other” to it in there. Then use this stored procedure as the source of your dropdown.

Translate

MillaZ
Nintex Employee
Forum|alt.badge.img+21
  • Nintex Employee
  • 663 replies
  • January 27, 2025

Hi ​@drezac have you solved your question? 

Translate

Forum|alt.badge.img+2
  • Author
  • Rookie
  • 7 replies
  • January 27, 2025

@tbyrne777 Thank you. For some reason, stored procedures are not coming up when I refresh the service instance, so we went with a view to create a union between the table data and “OTHER”. Now I’m just trying to get it to list the column data; It’s not showing data mappings and giving the error “No return properties. SmartObject: [SysOfCareOther] Method: [List]” when I run the view (just running for testing in a sandbox right now, so I’m not concerned with a form.

 

@MillaZ I made progress, but have not reached a solution yet.

Translate

Forum|alt.badge.img+13
  • Scholar
  • 499 replies
  • January 27, 2025

Is your database SQL Server or something else?

Translate

Forum|alt.badge.img+2
  • Author
  • Rookie
  • 7 replies
  • January 28, 2025

@tbyrne777 SQL Server. I realized that I needed to modify the permissions on the stored procedure after comparing some stuff. I can now touch the SP in the editor, and it’s not throwing an error, but it won’t populate the dropdown. When I set up the rule, there is nothing listed for input mappings.

 

 

Translate

Forum|alt.badge.img+13
  • Scholar
  • 499 replies
  • January 28, 2025

Are you able to execute the Smartobject method stand-alone via K2 Management? Just to confirm it works. Would you be able to post what the Stored Proc looks like? I’m wondering if it is formatted in such a way that it is confusing K2.

Translate

Forum|alt.badge.img+2
  • Author
  • Rookie
  • 7 replies
  • January 28, 2025

@tbyrne777 When I execute it from Management, it returns an empty list. Below this snip is the stored procedure.

 

ST_System_Of_Care is the original table with System being the names I want, and Status being Active or Inactive. After I select just the active names (which works as a SP in SSMS) I append “OTHER” at the end, and this all works in SSMS.

Translate

Forum|alt.badge.img+13
  • Scholar
  • 499 replies
  • January 28, 2025

I have noticed that using temp tables can confuse K2 integration - please try using a select from st_system_of_care with a union that includes your “Other” and that will work perfectly

Translate

Forum|alt.badge.img+2
  • Author
  • Rookie
  • 7 replies
  • January 29, 2025

OK, here’s the procedure with a UNION instead of INSERT INTO #temp (leaving stuff commented out until it works right). I’m getting what I want executing the snippet in SSMS, but still not getting thing anything executing the Smart Object method in Management.

 

I get a confirmation box when I execute the SP in SSMS. Should it do that? I have no parameters, and no need for any.

I decided to edit the Smart Object and it did something, but only returned one row.

 

 

Translate

Forum|alt.badge.img+13
  • Scholar
  • 499 replies
  • January 29, 2025

Make sure the Type of your Smart Object Method is “List” and not “Execute”:

 

 

Translate

Forum|alt.badge.img+2
  • Author
  • Rookie
  • 7 replies
  • January 29, 2025

That got me working. There were some other tweaks I had to make because of naming similarities (System vs SysOfCare) because one is the display value, and the other is the outbound value. It’s shown below so hopefully people after me can avoid similar mistakes.

@tbyrne777 If you’re ever around Central California, hit me up because I owe you some drinks. Thank you SO much. I sincerely appreciate all your help and patience.

 

 

Translate

Forum|alt.badge.img+13
  • Scholar
  • 499 replies
  • January 29, 2025

Ha ha glad I could help!

Translate

Forum|alt.badge.img+2
  • Author
  • Rookie
  • 7 replies
  • January 29, 2025

@tbyrne777 Side note: I was trying to play around with ordering so OTHER would be at the end, and I uncommented the #temp table stuff and commented out the UNION stuff, and it DID work, but sorted OTHER alphabetically, even though I don’t have any sort options set in K2. SSMS shows OTHER at the bottom, but not K2.

Translate

Forum|alt.badge.img+13
  • Scholar
  • 499 replies
  • January 29, 2025

It will work with #temp tables until you refresh your service instance, and then you’ll be pulling your hair out wondering why it suddenly stopped working. Instead of #temp try using the “with” clause, like so:

 

WITH
[systems_of_care] 
(
    [rank]
    , [system]
) AS
(
    SELECT row_number() OVER(ORDER BY [system]) AS [rank], [system]
    FROM ST_System_of_Care
)
SELECT [rank], [system]
FROM [systems_of_care]
UNION
SELECT 999 AS [rank], 'Other' AS [system]
ORDER BY [rank]
 

Translate

Forum|alt.badge.img+2
  • Author
  • Rookie
  • 7 replies
  • January 30, 2025

Thank you yet again, ​@tbyrne777 ! I can’t remember if I ever learned the WITH clause, but if I did I forgot about it. I’ll be sticking that somewhere in my brain for future use. After more tweaking (so much tweaking and testing), I got it to work in my dev environment. 

Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings