You are viewing limited content. For full access, please sign in.

Question

Question

Autotrigger lookups in Forms that have saved drafts

asked on December 6

So running into a lookup situation on a form.  

The user has a form that has a hidden unique ID.  This ID is in SQL and populates half the fields on the Form.

The other half of the fields on the Form are also populated from the same SQL database but the information may not be available at the time the user A is looking at the form.  If the info is not there, user A basically waits until User B (in another process) submits their form which updates the database with the info.  Then when user A opens their task again the info is filled in.

What happens sometimes is that the user A does a little work and then does a Save As Draft while the other fields are blank.  User B finishes there work but when user A goes back to their form they open the draft and the info is empty.  I end up un-hiding the unique ID, clearing it, putting it back in, and then it triggers.

Is there a way to get the lookup to trigger even when a draft is opened or everytime it's opened?

I already have the .attr("vo","e") on all the fields that get populated.

Thanks,

Chris

0 0

Replies

replied on December 6

Its a bit hacky but the way I have gotten around this in the past is to add the lookup code to a stored procedure and add a second parameter that isn't used. Then I attach the "fake" parameter to another field, this gives me access to the autofill button. Then I add the code to hide the autofill button, and then on load I have a javascript function effectively click the button.

Its not the cleanest solution but its worked for me in the past. Basically the lookup doesn't automatically run on load. Hmmm actually you could try adding something like setTimeout($('#q1 input').Change(),100); to your document ready code and that might do the trick a bit cleaner. Trick the form into thinking the value changed.

1 0
replied on December 7 Show version history

Thanks Aaron, I am going to try the setTimeout and see if it works.  But you are right, I basically just need the lookup to run everytime.  So after the form or draft loads, run it.  

Testing this seems to not have worked.  Now I am not all that knowledable of JS but inside the ready function I have the following:

 setTimeout($('#q58 input').Change(),1000);

Field 58 is the field that holds the ID for the lookup.

0 0
replied on December 7

Hey,

Try this: setTimeout(function(){$('#q58 input').change();},1000);

1 0
replied on December 8

Thanks Aaron that still did not seem to work.  In the meantime I have added a small drop down field that says Yes or No and modified the rule to include that as a second parameter to the lookup.  So if the user wants to refresh the lookup they can select Yes from the dropdown which fires it off.

0 0
replied one day ago

If I get some time today ill see if I can replicate your issue and come up with a solution.

0 0
replied on December 6

Would it be possible to prevent User A from starting their form if a certain column in the database is empty? For example, let them open the form and have the lookup run, but have a hidden field that populates from the lookup from a value that User B would submit. If that field is empty, show a message to User A letting them know that User B has not yet submitted their information. Not sure if it will work for your situation, but thought I would throw it out there.

0 0
replied on December 6

Thanks for the reply Blake.  I thought of something like that but they want to start working on the task while User B is still doing theirs.  It works fine if they don't save it as a draft.  Simply open the task, close, wait for user B to finish, open task again and the info will be there.  

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.