Empty Contact Selector field causes workflow to error - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Empty Contact Selector field causes workflow to error

Last post 08-03-2010 02:42 AM by colacat. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 07-12-2010 01:28 PM

    Empty Contact Selector field causes workflow to error

    I have a problem with browser-based InfoPath and our SharePoint workflow...

    I would like to create an InfoPath Taskform that gives the users the possiblity to select optional workflow members. What I mean is sometimes the workflow doesn't need to go through all office functions. However, if the form is submitted with empty contact selectors it will cause the workflow to error. I already tried to catch the empty string(s) in the workflow code, but it seems the problem happens before or when the information is transfered to SharePoint. Does anybody know what is going wrong ?

    I also tried to prepopulate the contact selector with the current user information. In case the Contact Selector is empty, fill it with the Current User and then submit to SharePoint. That did not work either because I couldn't find a way to set the focus on the Contact Selector before filling the Contact Selector fields.

    I would appreciate any kind of help! - I'm banging my head on my desk and it's starting to hurt. :o)   

    Thanks

  • 07-13-2010 05:37 AM In reply to

    Re: Empty Contact Selector field causes workflow to error

    In your InfoPath form, wouldn't it be possible to make the fields required?

    I think that's possibly the easiest solution, to force users to fill in that field.

    Good luck!

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 07-13-2010 06:57 AM In reply to

    Re: Empty Contact Selector field causes workflow to error

     

    I can do it and did it for 90% of the contact selectors in our workflows.

    However, if the workflow doesn't need to go to "finance" for example, I would get hunderts of phone calls with the question: "Why do I have to enter a person for "finance" if my case doesn't require finance to see it". So, I try to find a way to make the finance department an "optional" contact selector that can be left empty...

    Thanks for any ideas  

  • 07-13-2010 07:59 AM In reply to

    Re: Empty Contact Selector field causes workflow to error

     Why don't you set up a rule such that, on form submit, if the field is blank, you populate it with some dummy data?

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 07-13-2010 08:15 AM In reply to

    Re: Empty Contact Selector field causes workflow to error

    Exactly right, have you done it yet?

    I tried that, I can prepopulate the contact selector with a dummy name on formload, but I was unsuccessfull to fill in the contact selector fields on submit (or even through a simple button click event). For some reason it only works if I can set the focus to the 'DisplayName' field and then fill in the data. The next problem seems to be that you cannot set the focus to a field in a browser-based form. I'm going in circles here.

    Thanks 

     

  • 07-13-2010 09:00 AM In reply to

    Re: Empty Contact Selector field causes workflow to error

    I've implemented a similar rule (to set a blank field to a value before submitting) on other forms, just not with the contact selector. The Contact Selector is a bit difficult in the browser, some people avoid it altogether.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 07-17-2010 05:21 PM In reply to

    Re: Empty Contact Selector field causes workflow to error

    On your code have you try

    if(thefield != null)

    { //do something

    }

    ?

     

  • 08-03-2010 02:42 AM In reply to

    Re: Empty Contact Selector field causes workflow to error

    ISSUE RESOLVED !!

    if(thefield != null)

    { //do something

    }  

    That does not do it, because it will always throw an error and stops the workflow process if there is no value transfered.

    BUUUTTTT, I found out the way for Contact Selectors to "except" empty fields and still submit. 

    It will always throw an error if empty, therefore:

    try

    {

    variable = GetContactsFromXML(xxxTaskAfterProperties[xxx_FORM_DATA_KEY]):

    }

    catch (Exception) { }

    Of course, from now on you always have to ask if variable empty or not to do something with the user(s), but that finally did the trick.

    I hope it helps someone. 

     

Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.