SCNULL SmartObject method parameter mapping not working

  • 30 April 2015
  • 3 replies
  • 3 views

Badge +2

Hi,

 

I have a SmartObject setup where one of the parameter mappings for its List method is set to Static Value SCNULL.  Anyhow when I test the method I get a "failed to convert the parameter value from a String to a Int32" error.  If I change SCNULL to 0 (my current workaround, and then convert 0 to a NULL in the Stored Procedure), then everything works fine.

 

Any ideas why the SCNULL wouldn't be working in this instance?  I use SCNULL in another SmartObject's Execute method and it seems to work as intended.

 

Thanks

Peter 

 

11693iE83168B54A5B8BBE.png

10868i11C2374334D4E7A4.png

13347iB6F166E4A29C9378.png


3 replies

Badge +10

Hi,

 

I believe its because the input type is a integer and when you pass SCNULL, in my experience this is not passed through as null, its passed though as a string SCNULL. It's the equivalnet of passing "mynameisbob" as far as the stored procedure is concerned. It will try and convet that string into an integer which obviously fails.

 

@Update: What I would do is change the stored procudure parameter to be null. THis way you will not have to pass in anything if you dont want to. 

So something like the following when you initialise the stored procedure input parameter will work.

 

declare @quotelineId [int] = NULL

 

 

Hope that helps

Badge +2

Ah OK thanks, I thought SCNULL would translate into NULL of the data type required for the parameter.

 

The default for the parameters is already NULL, however that leads into another issue we're having where the ServiceObject is showing "- Required" for all SP parameters even where they have a defualt specified.  Anyway just using a 0 is a sufficent workaround for the moment.

 

11221iBF74CB3E9DD2BBBF.png

Badge +10

There is another post that the user had similar issue. Please try setting the Use paramteres for stored procedure to false n the service instance type for that database.

 

Here is the link to the post for your reference:

http://community.k2.com/t5/K2-blackpearl/Required-Stored-Procedure-Parameter/td-p/53439/page/2

 

Reply