Issue with rules related to people pickers

Home Forums Classic DFFS Issue with rules related to people pickers

Viewing 2 reply threads
  • Author
    Posts
    • #38197
      Travis Goodman
      Participant

        Hey Alex,

        In a list I still use classic on (which 90% of my DFFS is still on classic — I’m on v4.4.5.35) I’m having issues with rules that deal with people pickers not firing consistently.

        I have a rule that says If [PeoplePicker] is equal to [blank]

        When I say [blank] I mean I literally put no text or anything in the “This Value” section, I just leave it empty because I’m wanting to check if the field is empty or not.

        This works like 50% of the time, and it has to be related to the user profile entered into that field not validating on time. I’ve extended DFFS loading by 5000ms and it gets a little better, but still has issues. I’ve even had it delayed up to 10000ms and I can’t keep raising the delay.

        Is there a workaround for this?

      • #38198
        Alexander Bautz
        Keymaster

          Hi,
          Are you using a rule triggering on form load or on field change?

          It can be done using custom js so If you can give me some more details I can give you a code example.

          Alexander

        • #38203
          Travis Goodman
          Participant

            I have tried both onload only and onload and onchange. It’s not that it doesn’t work, because it does… just not consistently. The rule evaluates before the peoplepicker resolves. What I noticed is that onchange it doesn’t revalidate.

            Setup is the rule for PeoplePicker is equal to [blank] and then I don’t do anything with it at that point. What I do is I reference that in a Linked Rules and Functions section of other rules and I have the box checked so that a change in that rule will revalidate the parent rule. That’s where I’m seeing the inconsistent experience.

            • #38206
              Alexander Bautz
              Keymaster

                You can try using this Custom JS instead of using rules to detect the change on the PP.

                function peoplePickerChanged(fin){
                    var currPPvalue = spjs.dffs.beforeProperties[fin];
                    if(currPPvalue.length === 0){
                        console.log("The field is empty on form load");
                    }
                    setInterval(() => {
                        let val = getFieldValue(fin);
                        let isResolved = spjs.utility.getFieldValue({"fin": fin, "key": "isresolved"});
                        if(!isResolved.includes(false) && String(currPPvalue) !== String(val)){
                            currPPvalue = val;
                            console.log("Changed to", val);
                            if(val.length === 0){
                                console.log("Is empty");
                            }
                        }
                    },1000);
                }
                peoplePickerChanged("PeoplePicker1");
                

                Alexander

          Viewing 2 reply threads
          • You must be logged in to reply to this topic.