Skip to Content
0
Former Member
Jul 07, 2014 at 06:29 PM

validate value in custom BO OnSave

115 Views

Hello,

I created a custom BO facet in Marketing -> TargetGroup.

I am creating a line item in my custom BO, when I create contact in Members Tab.

But Before creating line item in Custom BO, I am trying to validate a field value from TargetGroup. Then based on the field value, line item will be created in Custom BO.

Based on my requirement, created OnSave Validation script in my custom BO and checking value as mentioned below and put a break point at first statement

var tGroup = TargetGroup.Retrieve(this.ToRoot.TargetGroupUUID);
if( (tGroup.ListType == "101") || (tGroup.ListType == "102") ){
     return true;
}else{
     return false;
}

When I create contact and save from Members tab, I don't see any stop at OnSave validation break point

I created BeforeSave Event and created reference as mentioned below

var tGroup = TargetGroup.Retrieve(this.ToRoot.TargetGroupUUID);

and put a break point and executed in debug mode. Able to stop at Break Point in BforeSave event. Problem is I am not able to return any true or false from BeforeSave Event to prevent saving data into custom BO.

If my condition returns true then line item should insert into custom BO. Otherwise Line Item should not be created.

Can any one help me.

Thanks in advance.