Skip to main content

I have a WCF Service that I call from a button's click event.  The WCF service created can have 9 parameters.  Some or any of the parameters can have null values, that is, the controls that the users can choose, are not chosen.  The service knows what to do with this use-case.  The problem is that smartform rule will not allow the submittion to the WCF, the rule generates "required property for selected method Read. Value must be set," but this is not true.  All parameters can be null.  What should I do?

 

Taffy

Try using the value scnull for parameters whose value you wish to be null.  This is some sort of reserved word in K2 and a .NET NULL is substituted for this value when it is encountered.  I've used this in your scenario before.


Thanks for the reply sbrown,

 

I'm a little confused, I saw a post talking about this earlier today.  Where do I apply the "scnull" value.  Is there some default value entry you're referring to?

 

Taffy


When supplying the values to your SmartObject method parameters, instead of using the control value supply scnull.  You might have to do this with an IF statement to check the value of a particular control.


So sbrown,

 

Your solution worked for me.  Thanks!  Curious, I thought about what you wrote and first created a solution where I created an expression and in the expresion I put If(Is blank(control), scnull,control) and then I put the expression in the service call.  It didn't work.  Then, I created a textbox that is hidden, then on the search button click event, I checked for a value in the form control, if it doesn't have a value, I set the textbox to "scnull," if the control has a value, i set the textbox to the control's vaule.  I then put the textbox in the call.  This worked.  I'm not sure if this is the way you were talking about doing it--if you have any thoughts or better ways that should be working let me know.  Thanks again for the input.

 

Taffy


Reply