Rule issue with multiple content types

Home Forums Classic DFFS Rule issue with multiple content types

Viewing 11 reply threads
  • Author
    Posts
    • #24476
      Leonid
      Participant

        I have a SP list with multiple content types.
        Several content types have a Person field “TrainingCoordinator” and some don’t. The form has a Rule that checks peoplepicker for that field. When the EDIT form comes up for a content type which doesn’t have “TrainingCoordinator” field, DFFS throws an error attached. Even with linked rule defined to check for the content type, error still thrown. The EDIT form works fine when called on other content types.

        Attachments:
      • #24484
        Leonid
        Participant

          Seems its a specific bug. When this error occurs, it prevents cascading dropdowns render

          • This reply was modified 5 years, 8 months ago by Leonid.
        • #24488
          Alexander Bautz
          Keymaster

            Hi,
            When you use content types you will have to create rules that only triggers if you have a specific content type.

            I suggest adding a rule in the top of the rules section for each of the content types and have them trigger on “Content type = your content type”. These rules does not have to do anything, but you can use them in the “Linked rules and functions” in your other rule to ensure it only triggers if the correct content type is detected.

            I generally don’t recommend using content types with DFFS – you can create the different form layouts using rules and tabs in DFFS to mimic the functionality.

            Alexander

          • #24492
            Leonid
            Participant

              Alex,
              That’s pretty much what I’ve tried. Yet, Even when the rule is NOT a match, DFFS error still thrown as if the rule is processed. Here’re snapshots

            • #24499
              Alexander Bautz
              Keymaster

                OK, it seems the function that tries to validate the people picker fails when the field is not in the content type. You need to make some changes and create two rules like the attached images, and then one function in Custom JS like this:

                function isCorrectCT_setPeoplePicker(){
                    var isTC = spjs.dffs.beforeProperties.TrainingCoordinator_ID[0] === String(_spPageContextInfo.userId);
                    if(isTC){
                        spjs.dffs.triggerRule(["isTC_CallFromCustomJS"]);
                    }
                }

                Please note that you should NOT use quotes around the content type names in the rule trigger “This value” field.

                Let me know how this works out.

                Alexander

              • #24503
                Leonid
                Participant

                  Thanks Alex,
                  In my scenario the rule checks if current user is the one in peoplepicker. That’s where the error happens. Do I understand correctly that I cant use the rule trigger for that and have to use javascript function to compare current user with peoplepicker?

                  The preferred solution would be to allow rules on every field present in list definition regardless of which content type it belongs to.

                • #24505
                  Alexander Bautz
                  Keymaster

                    You can use the workaround I suggested, but I’ll look into changing it so it will not throw this error, just return false if the field it not present.

                    Alexander

                  • #24523
                    Leonid
                    Participant

                      Awesome, Alex, thanks!
                      BTW,

                      spjs.dffs.beforeProperties

                      is a hidden gem!

                    • #24527
                      Leonid
                      Participant

                        To close this topic, is there DFFS syntax to add actual field control programmatically?
                        I understand that control’s values can be added as {<control_name>} and {{<control_name>}}. Say if my control is a choice dropdown, is there a way to add it vs writing the whole HTML?

                      • #24529
                        Alexander Bautz
                        Keymaster

                          No, DFFS does not insert these controls, it overlays the default form and uses the already available controls.

                          Alexander

                        • #24697
                          Leonid
                          Participant

                            Alex, another test run negative with Content Type edit form. The field defined in current CT still doesnt show, nor das a row with variable linked to the field. Please advice

                            • This reply was modified 5 years, 7 months ago by Leonid.
                          • #24703
                            Leonid
                            Participant

                              Never mind, found an problem with reversing rules…

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