Do presavaction rules ignore the if these rules true/false section?

Forums Dynamic Forms for SharePoint Do presavaction rules ignore the if these rules true/false section?

This topic contains 2 replies, has 2 voices, and was last updated by  Alexander Bautz 5 months, 2 weeks ago.

  • Author
    Posts
  • #15965

    nils.enhoerning
    Participant

    Howdy πŸ™‚

    I am a bit stumped with a case I am working on. On the edit form of an item I am using a rule to send emails (using sp2013 rest variant, no workflows involved). This rule is called “send email if more info has been provided”, runs on the trigger the form is saved.

    There is a secondary rule with a friendly name of shallEditEmailBeSent and is in the “And these rules or functions = true / false” section of my rule.
    In this rule i check if a field with a checkbox (called “notify approvers of changes”) is set to true or false.

    So long story short: If the user edits the item, an email should be sent only if this checkbox is marked.

    The result: Regardless of if the checkbox is marked the email is sent.

    I have also tried using the JS function below to see if the rule itself is just not firing and using it instead (internal field name is a bit different, but the function works in isolation from this rule without any problems):

    
    
    function checkIfEmailIsToBeSent(){
        if(getFieldValue("SendEmailToCurrentApprover")){
            return true;
        }else{
            return false;
        }
    }

    I have also used debug to check that the rule works as intended, where it shows some… interesting behavior.

    First it shows me that the check for email sending works as intended:
    shallEditEmailBeSent (on change) [16:13:26.18]
    Trigger: SendEmailToCurrentApprover
    Current value: true
    Operator: Equals
    Target value: true
    Match = TRUE

    And respectively False when the box is unchecked.

    Funnily enough if i hit the save button with the checkbox marked (i.e. the rule should return true) the debug tells me no email will be sent, and without it marked it declares the email will be sent.

    Still, regardless of the actions taken in the form with debug off (checkbox marked, or not marked) the email is sent.

    So I am left wondering: bug or feature? πŸ˜€

    P.s. version info of dffs:
    DFFS frontend: 4.4.2.5
    DFFS frontend CSS: 4.21 / 4.21
    Autocomplete: 1.4.12
    Cascading dropdowns: 3.6.5
    jQuery: 1.12.4
    Lookup: 1.1.5
    Resource management: not loaded
    SPJS-Utility: 1.270
    vLookup: frontend v2.2.79

    Attachments:
  • #15981

    nils.enhoerning
    Participant

    Nevermind, I am an idiot πŸ™‚

    Solution was simple after some food and coffee -> add the email sending logic to the rule checking the checkbox, and allow reversal. Problem solved.

    I am not a smart man, sorry for wasting space on the forum πŸ˜›

  • #16002

    Alexander Bautz
    Keymaster

    Not are not so dumb as you might think – you figured it out, right πŸ™‚

    I’ll leave your question here as I’m sure it will be helpful for others with the same problem.

    Best regards,
    Alexander

You must be logged in to reply to this topic.