Workflow and ServiceDesk Community

 View Only
Expand all | Collapse all

Null Date Picker = "Object reference" error

Migration User

Migration UserApr 12, 2013 09:30 AM

Migration User

Migration UserApr 15, 2013 09:22 AM

Migration User

Migration UserApr 16, 2013 09:12 AM

Migration User

Migration UserApr 18, 2013 09:17 AM

Migration User

Migration UserApr 18, 2013 01:57 PM

  • 1.  Null Date Picker = "Object reference" error

    Posted Apr 10, 2013 10:42 AM

    I'm using date pickers in my workflow. If one of them is blank, and I leave the page, then return to the page; I get the symantec error page. The error from the log viewer is "object reference not set to an instance of an object"

    Anyone know why this is happening? How can I prevent this error? I'd like the users to be able to blank out the date fields.

    Thanks.



  • 2.  RE: Null Date Picker = "Object reference" error

    Posted Apr 12, 2013 02:37 AM

    Maybe you're using an output variable as initial value too?

    Did you get the stack trace? It would be helpful.



  • 3.  RE: Null Date Picker = "Object reference" error

    Posted Apr 12, 2013 09:30 AM

    What is a stack trace?



  • 4.  RE: Null Date Picker = "Object reference" error

    Posted Apr 12, 2013 09:35 AM

    Stack trace around this issue can be found in logs... <install>/Logs



  • 5.  RE: Null Date Picker = "Object reference" error

    Posted Apr 12, 2013 09:38 AM

    I don't think you can blank out the date or else you get the error you see. 



  • 6.  RE: Null Date Picker = "Object reference" error

    Posted Apr 12, 2013 12:05 PM

     

    AnaMan, I am using a dynamic model thing for the initial data, and I'm using the output variable in that model. I think that might be the problem. I'll take a look at it and let you know.
     
    Here's the extremely helpful error from the log viewer:
     
    System.Exception: Execution Exception ---> System.Exception: exception component created:  ---> LogicBase.Framework.BusinessRuleException: The critical error failed execution on component App Details : Object reference not set to an instance of an object. : at LogicBase.Components.FormBuilder.DatePickerComponentRenderer.PreRender() at LogicBase.Components.FormBuilder.Core.FormComponentRenderer`1.LogicBase.Components.FormBuilder.Core.IFormComponentRenderer.PreRender() at LogicBase.Components.FormBuilder.FormBuilderComponentRenderer.PreRender() at LogicBase.Core.Models.Dialog.ComposerForm.OnPreRender(EventArgs e)
       --- End of inner exception stack trace ---
       at LogicBase.Core.ExecutionEngine.ExceptionComponentDelegate.Execute(IData data, IOrchestrationComponent comp, String& outputPath, IExecutionEngine engine, TLExecutionContext context)
       --- End of inner exception stack trace ---
       at LogicBase.Core.ExecutionEngine.AbstractExecutionEngine.RunEngine(List`1 executionQueue)


  • 7.  RE: Null Date Picker = "Object reference" error

    Posted Apr 15, 2013 02:53 AM

    Judging form the stacktrace - the three properties cannot have a null value in this execution step: Min Date, Max Date and date set to a form control.

    A form control date is set by an initial date. So you can be right - if you are using the output variable in the initial value model you have to protect this model from returnig a null value as a result.

    How are you setting the minimum and maximum dates? Are you using the constants or other value source?In the latter case is possible you provide a null value to Min or Max Date property.

     



  • 8.  RE: Null Date Picker = "Object reference" error

    Posted Apr 15, 2013 09:22 AM

    The min/max dates are just default constants.



  • 9.  RE: Null Date Picker = "Object reference" error

    Posted Apr 16, 2013 02:05 AM

    So as I said - if you are using dynamic model for initial value prevent it from returning a null value. You can use an Variable Exists Rule component and, in case of false, return for instance a today date.



  • 10.  RE: Null Date Picker = "Object reference" error

    Posted Apr 16, 2013 09:12 AM

    I'll try it out.



  • 11.  RE: Null Date Picker = "Object reference" error

    Posted Apr 16, 2013 09:47 AM

    Tried it, still no luck. I even wiped the dynamic model and set the initial date to "Start Today" and still got the same error.

    This doesn't make any sense.....



  • 12.  RE: Null Date Picker = "Object reference" error

    Posted Apr 17, 2013 12:44 PM

    I just figured out there is a defect with the DatePicker and DateTimePicker components.

    I have created a KB article for this, KB article TECH205198. This article will not be public until tomorrow.

    The problem with these components is this:
    The components will automatically initialize the default values to be the values of the Output data, even though you tell the component to use a different variable as the default.

    I believe you're experiencing the "Object reference not set to an instance of an object" when you don't provide a value to this because it won't accept a NULL value.
     

    What I would suggest as a Workaround would be to put a check in your Workflow before entering the form. With this check, ensure the Output variable exists, and is set to the value you would like the form to default the date/time to.

    Hope this helps!



  • 13.  RE: Null Date Picker = "Object reference" error

    Posted Apr 17, 2013 12:53 PM

    As an aside... DateTime is a value type in C#, like an int; it can't have a null value. A nullable datetime i.e. DateTime? yes, but not a datetime.



  • 14.  RE: Null Date Picker = "Object reference" error

    Posted Apr 18, 2013 09:13 AM

    Oh wow. Thank you.

    What is a KB article? Is it like a bug fix request?

    I'll try this workaround suggestion.

     



  • 15.  RE: Null Date Picker = "Object reference" error

    Posted Apr 18, 2013 09:17 AM

    KB = Knowledge Base, so a Knowledge Base article.



  • 16.  RE: Null Date Picker = "Object reference" error

    Posted Apr 18, 2013 11:10 AM

    I did the workaround. It's not quite working.

    I have a variable exists component before the form that checks the date. If the output data doesn't exist, it sets it equal to today, then goes back to the form with the date picker on it.

    This actually works the first time the workflow goes down this path. But if I set the date to null again and go down the same workflow path, I get the same error, but it fails right at the "Variable Exist" component, not at the form. 

    This whole thing is blowing my mind....



  • 17.  RE: Null Date Picker = "Object reference" error

    Posted Apr 18, 2013 12:11 PM

    The variable actually does exist, it just can't be NULL. Perhaps on your way back into the Form add a Remove Data component, removing the datetime variable before you re-enter the form.

    Which version of Workflow are you using?



  • 18.  RE: Null Date Picker = "Object reference" error
    Best Answer

    Posted Apr 18, 2013 12:32 PM

    After doing some testing, I am able to reproduce this. If you ever set that date to NULL, you will be unable to use the form again without throwing an exception. This happens even if you try to remove the variable, or set it to something other than NULL later.

    I could not find a workaround for this other than not using a NULL value for the date, c# does not allow this and Workflow is run using c#.



  • 19.  RE: Null Date Picker = "Object reference" error

    Posted Apr 18, 2013 01:57 PM

    Okay :(

    I appreciate all the help.