Validate required Fields Trigger keeps firing - Forum - Rollbase - Progress Community

Validate required Fields Trigger keeps firing

 Forum

Validate required Fields Trigger keeps firing

This question is not answered

Hello,

I have a new record form that has a related lookup field that needs to be filled in before the record is created/saved. I am using a validate required fields trigger to check that. In the earlier version of Rollbase i.e. 3.0.5.0, this used to work perfectly fine. However in the latest release i.e. 3.2.0.0. this validation trigger keeps failing despite having a value in my related lookup field. Any suggestions why this is happening? I am calling the trigger before create/before update.

All Replies
  • Hi,

    Are there any errors found when you debug (Debug that is beside the New Trigger) the triggers?

    Regards,

    Orchid

  • When I click on the "Debug formula" in the trigger itself on an existing record, it works fine in that debug window but when I allow the trigger to run on the record and if I keep the debug window on the side while updating the record and trying to save it, it keeps showing the error with regards to validating the record data even if I have a value assigned to that field. The "Debug" window shows that there is no value for that field where as on the edit/new page of the record there definitely is a value assigned. I have even checked the DOM to see if there is a value selected for that control. I have the trigger set the validate record data : Before Update/Before Create.

  • Please provide script used in your trigger.

    Are you talking about Related field which points to Lookup field? Please clarify what "related lookup field" means.

  • Its a lookup field on the page that is a related to another object when a relationship is made between two objects.

    // Check if this related field is not empty

    if("{!RrelatedObject}" === "")
    
    {
    
    return "Please check this related field and try again.";
    
    }

  • In Rollbase terms this is just Lookup, not Related Lookup field.

    Please try this condition:

    if ("{!RrelatedObject}" == "" || "{!RrelatedObject}" == "-1")

  • I am still getting that error. Also I have got a warning now asking me to use "===" instead of "==".

  • I created Validation trigger with the following script and it works as expected:

    if ("{!R719765}"=="" || "{!R719765}"=="-1") return "A must be attached";

    Please verify that your template token {!RrelatedObject} actually points to Lookup field.

    As work around I recommend making that Lookup field "required" on your using Page Designer. This way your users will now that they must provide a value before submitting data.

  • I cannot use the required field option because I am hiding and showing that field based on a picklist option selection and in my trigger I'm checking that condition i.e. if that option is selected in the picklist, only then check whether that field is empty or not. It is still not working. I have migrated my app from version 3.0.5.0 to version 3.2.0.0. Its working fine in version 3.0.5.0 but not in this version.

  • As a very basic test on the CRM system supplied by Rollbase I went ahead and tried this on the Contacts Object. A very simple test to check whether there is an account selected before a contact record is created and it still fails.

    if("{!Raccount}" == "" || "{!Raccount}" == "-1")
      return "Please enter an Account";

    I keep getting an error of "Please enter an Account" even if I select an Account.

  • Also I have checked it by printing it the log file and I keep getting that the account is empty even if I select one.

    [2015-04-17 09:18:13,326] Account is:
    [2015-04-17 09:18:15,936] Account is:
    [2015-04-17 09:18:48,826] Account is:
    [2015-04-17 09:18:54,607] Account is:
    [2015-04-17 09:18:56,186] Account is:


    May I ask what version are you guys using to test this as I still can't seem to get this very basic trigger working. Looking forward to your replies.

  • I can see that this has been reported as a bug in one of the posts. Can you suggest an alternative way of making this work?

  • I have a Look up field for which I have custom validation set on that field as mentioned below:

    if ("{!opportunityLookUp}" === "") 
    {
    return "Please select an Opportunity.";
    }


    But the above mentioned validation doesn't work on Lookup fields. I cannot use the Rollbase required field option because I am hiding and showing that field based on a certain checkbox selection. Could anyone suggest a solution for this issue please? Cheers.

  • Hi,

    I tried the case that you mentioned in rollbase.com and it is working fine for me.

    The code that I used.

    if("{!R143465806}"===""){

     return "Task should have value";

    }

    Here, R143465806 is an integration name of look up field. I defined many-to-many relationships in between those objects.

    I have configured above code in look up field's validation page and getting error whenever look up field is empty.

    Thanks and Regards,

    Chandra.G

  • Could you confirm to me that you are trying this validation before creating the record?

  • Basically I have migrated my Apps from version 3.0.5.0 to 3.2.0.0 and I noticed that the dependent Objects were removed in version 3.2.0.0. So I went ahead and manually added them. However it still doesn't seem to work. As a basic test like I mentioned in the rollbase provided CRM system, I performed this same test on the Account Lookup field that can be found when you create a new contact and have set the validation on that field as well. It still keeps failing like above. I'm not sure what's happening here. It seems to work perfectly fine in the previous version i.e. 3.0.5.0.