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

Question

Question

How to disable lookup rules on the fly

asked on September 9, 2022

Is there a way to disable lookup rules on the fly (I'm reusing same form for multiple user tasks, and most lookups on the form are only needed for the Start Event task) ?
Basically, I'm looking to achieve programmatically the same effect as turning them off at design-time via the "Enable lookup rule" checkbox.

The closest I could get was probably when trying to remove the event handlers on the "when/matches" field of the rule, but it didn't help and the lookup fired anyway. Something like this:

$(document).ready(function () {
  if ($('.stepnametextbox :input').val() != 'Start') {  
    $('.studentnumbersis :input').off('change').off('lookup');
  }
});

 

Could this be done somehow ?

Thanks

Lau

1 0

Replies

replied on September 14, 2022

There is no easy way to disable lookup on the fly. Can you share with us why you don't want lookup rules to be enabled for the user task? And what is the main reason you don't want to use multiple forms by copying the form used by start event and then disable the lookup rules?

0 0
replied on September 15, 2022 Show version history

It's all about my choice of reusing the same form for all steps/tasks (I'm actually a programmer and I feel that a copy/paste approach has many issues, the lack of maintainability being the most important one) and, although I've hit a few roadblocks & limitations when using a single form throughout business processes, I still prefer it.

Take the hypothetical (and simplified) scenario of a program application received by a college. The applicant will need a lot of information available in order to apply (programs, levels, offers by campus&semester, etc.) and, thus, a series of lookups. Once submitted, the form might go to a number of offices (admissions, academic, records, credit transfer, etc.). It's 90% the initial form plus a bit of extra info (and lookups), needed at every stage (maybe the program curriculum for academic, maybe the program coordinators list for admissions, etc.). Overall, the form might make 7 stops before approval.
I organize the office specific data into sections which are easy to manage with "Field Rules" and JS code using a stepname dynamic variable to handle the 10% differences (basically my single form contains everything). I realize it's not the perfect approach but I definitely believe it being the lesser evil (I don't even want to think about what mess a business process with 7 initially-identical forms could become in time, after a series of changes; or how a form change will have to be applied 7 times, one time for each copy - did I also mention that I am lazy ?)

Anyway, for all these reasons and more, I prefer the single form approach and it seems that the biggest nuisance is the (mostly start event) lookups, firing pointlessly at every stop (first problem being the time wasted on loading the form, the other might also be undesired updates of submitted data).
An easy way to fix it (by disabling selected lookups on the fly depending on the current step) would be as shown in my JS code above - if it would work.

I apologize if my story was too long but I tried to provide good explanations about my choice and the reasons behind it.
Thanks for taking the time to understand and help with my issue.

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

Sign in to reply to this post.