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

Question

Question

How to update lookup field if the DB is changed midstream

asked on February 14, 2018

I have a process that pulls the Project Manager into a hidden field in the form and then uses the value to send emails at certain points.  Problem is if the PM is changed in the source DB midstream (while the form is in flow) the 2nd form, in the review user task, doesn't automatically pickup the new PM.  I see this behavior whether the field is hidden or not.

Here is my lookup rule

 

 

The user selects a Client in the Client field, which pulls back a list of projects associated to that client.   They then select a Project, and that pulls back the PM and City, State.

 

I found this thread that provides custom code to force a lookup, but when I use that code on the Project and PM Fields it still doesn't automatically update the PM:

https://answers.laserfiche.com/questions/114588/Form-not-refreshing-SQL-table-look-up-values#120808

So, how can I can configure it so that if the PM changes in my source DB, the forms that are in flow automatically pick up that change?

0 0

Answer

SELECTED ANSWER
replied on February 14, 2018

Hi Alon

It is normal behavior that the lookup is only triggered on the initial form and doesn't run again while the form continues through the task process. To update the lookups you have to use JS to retrigger the lookup.

In the case of the code from the article you found, you may want to change from \\(1\\) to input or textarea such as this and see if that works better

$(document).ready(function() {
$("#Field3 input").attr("vo", "e");
$("#Field5 input").attr("vo", "e");
})

We have used this where we have added a class to the field to be updated.
#Field15 is the field that the lookup would be based on which we are basically retriggering.

$(document).ready(function() {
$(".DbRefresh input").attr("vo", "e");
$(".DbRefresh textarea").attr("vo", "e");
$("#Field15").change();
});

Not perfect, hope it helps. We have made a feature request to LF to make an option to retrigger the lookups when the task is opened.

0 0
replied on February 14, 2018

Thanks Steve,

So if I use this code, targeting the Project Field, it makes that field blank and I have reselect the project.  That isn't what I am going for though.  I want to leave the project as is and just have it update the PM.  Any tips?


Force lookup of hiddenPM <--Doesn't seem to wok
 

$(document).ready(function() {
$("#q4 input").attr("vo", "e");
})

 

0 0
replied on February 14, 2018

The Value you should put in the place of the "#q4 input" should be the HiddenPM field which is the one you want to update, not the lookup field.

If #q4 may also need to be replaced by #Field4 which again would represent the HiidenPM field

1 0
replied on February 14, 2018

Thanks Steve!  The combination of using input instead of \\(1\\)  and targeting the correct field get me to my goal!  

0 0

Replies

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

Sign in to reply to this post.