Skip to main content

I just want to specify NULL as a SmartObject input parameter of non-text type in the SmartObject event wizard, I can't seem to figure out how to do this.  Typing "scnull" does not work because the wizard says it doesn't match the data type.  Any suggestions?

 

Right now it's a Number type but I also need to do it to a DateTime.  I tried using ToInteger(scnull) function and, while the Wizard was happy with that, the workflow was not when I ran it.  Error'd out with "Input string was not in the correct format."


15605i942AC481BA6B7843.jpg
15935i8004FF4899BC27A6.jpg

Victoria


 


Is there a reason that you can't just leave the mapping blank? That should work the same as passing a null value.


 


Ian


HI Victoria

 

I'm not sure is possible to pass a null value to a required parameter (it is required for a reason).

 

As Ian says you can pass an empty value (to a non required parameter) just by leaving the mapping  blank.

 

As for dates, please see the following

 

http://community.k2.com/t5/K2-blackpearl/Error-when-attempting-set-DateTime-field-in-workflow-to-null/ta-p/76284

 


Well, leaving something blank is different than passing null, I think that's just good practice.  I don't think I'm asking anything unreasonable :/

 

OK thanks anyway.


Well I made it not required but it's still a problem, because I am populating it as blank with an IF condition function and the IF condition function won't let me leave a value as blank.  And empty string doesn't work because it's not the right data type.  So it looks like I need to have two separate events to do exactly the same thing except for this one field.  Kinda silly :/


Hi Victoria,

 

If you are trying to save NULL values in SQL table, there is workaround for this, I usually Create Stored Procedure to insert records into my table, I define parameters with default values(NULL), In case I don't pass  values it will be saved as NULL.

 

of course it's not the best solution you can find, but am not aware of any other solution.

 

 


Hi, have you tried just adding a space? I've done this before for a required parameter and it worked but it might depend on the service you're trying to consume.

 

You could also try adding in an empty string from Inline functions, this is available both for the Workflow and on SF expressions.


Why can you submit NULL value as a testing option from the SmartObject Services Tester but not have a clear way to do it from workflow/datafield option?


If you in the workflow excute the smart object without a value. After that you could have a line rule in a separate activity that checks if the datafield is not equals to zero.  And excute the update method with a integer. It would be nice if it could handle this.


15751i88F288F8A6B30544.png

I just got help from K2 Support on this, so the credit goes to them.

 

If you made the SQL stored procedure, you have to give the parameter a default value.

Example:

@CurrentUser AS NVARCHAR(50) --Will always be required in the SmartObject

@CurrentUser AS NVARCHAR(50) = NULL --Will not be required

 

Additionally, if you create the smart object in the SmartObject Services Tester, there is a "User Required" field.  By default it inherits the "Is Required" which is determined by whether or not the parameter has a default value.  If the parameter does not have a default value in SQL, the "Is Required" field cannot be unchecked.  I don't think you can set "User Required" when creating a SmartObject in K2 Studio or SmartForms.  I think the tester is the only place to do that.

 

You can also make a new (or change - not recommended) service instance and change the "Use Parameters for stored procedures" field to false, but then those SQL parameters appear in the SmartObject as a SmartObject Property and not as a Parameter.  I think this could work, but I think I prefer the other way.


13467i5D1A5746AD2E68BB.png

Reply