Validate required Fields Trigger keeps firing

Posted by IramK on 15-Apr-2015 04:51

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

Posted by Orchid Corpin on 15-Apr-2015 10:05

Hi,

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

Regards,

Orchid

Posted by IramK on 15-Apr-2015 10:12

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.

Posted by pvorobie on 15-Apr-2015 10:33

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.

Posted by IramK on 15-Apr-2015 10:37

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.";

}

Posted by pvorobie on 15-Apr-2015 10:47

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

Please try this condition:

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

Posted by IramK on 15-Apr-2015 10:55

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

Posted by pvorobie on 15-Apr-2015 12:30

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.

Posted by IramK on 16-Apr-2015 03:31

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.

Posted by IramK on 16-Apr-2015 05:32

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.

Posted by IramK on 17-Apr-2015 03:21

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.

Posted by IramK on 20-Apr-2015 03:52

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?

Posted by IramK on 21-Apr-2015 03:37

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.

Posted by Chandrasekhar Gontla on 21-Apr-2015 06:21

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

Posted by IramK on 21-Apr-2015 06:44

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

Posted by IramK on 21-Apr-2015 07:06

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.

Posted by Chandrasekhar Gontla on 21-Apr-2015 07:22

Hi,

I tried the case below case as well.

In CRM app, Added validation for Account look up filed.

Getting the error when try to create a contact without providing a value for account.

It is working fine for me.

Note: Make sure that both Contact and Account objects should be in Core Objects but not in Dependent Objects list.

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

Yes. The validation is happening when creating a record. Means, record is not getting created as expected by throwing that error.

Thanks and Regards,

Chandra.G

Posted by pvorobie on 21-Apr-2015 11:11

This is confirmed defect: PSC00331315

Posted by IramK on 22-Apr-2015 03:02

Thanks [mention:05b5f00eae4a468d844fa8bedcafd110:e9ed411860ed4f2ba0265705b8793d05] for confirming that. Could someone possibly help me out with a solution that I could use on the client side instead of using server side validation?

Posted by pvorobie on 22-Apr-2015 11:08

You can add script for onsubmit events on Page > Properties page.

Posted by IramK on 24-Apr-2015 03:30

Yes I can add script for onsubmit events but how do I verify whether a lookup field's value has been set?

Posted by pvorobie on 27-Apr-2015 14:18

It seems like problem only appears when integration name of Lookup field is not the same as integration name of Relationship. By default these names are identical.

Posted by IramK on 08-May-2015 03:12

So if we make the integration name of the lookup field same as the integration name of the relationship, will this solve the problem?

Posted by pvorobie on 08-May-2015 11:38

Yes, it should. Otherwise please wait for release of fix.

Posted by Orchid Corpin on 12-May-2015 13:45
Defect PSC00331315 has been fixed and will be available for the release 4.0.0.0
Posted by IramK on 04-Nov-2015 11:24

Hello,

Just a quick question: has this issue been fixed in the New UI version: 4.0.2.0? Kindly let me know.

Cheers.

This thread is closed