cancel
Showing results for 
Search instead for 
Did you mean: 

Clear Lookup (Relation) Attribute with Script

Mike_Lesinski
Confirmed Champ
Confirmed Champ

Hello, 

Is there a way to clear out a lookup attribute via a client side script? I've tried a few different combinations to clear the value but nothing seems to work with look-up fields. Any suggestions? Currently using Onbase 16 & upgrade to 18 within the year.

See screenshot below of what i'd like to clear with a on screen button. 

0cfd22c53132498a88e8adb00a185adb

Thanks,

Mike

1 ACCEPTED ANSWER

Mike_Walkuski
Employee
Employee

Hi Mike,

You should be able to do this just by setting the field to null. Your syntax will look something like this.

Screen.CurrentView.Fields("RELATIONSHIPATTRIBUTENAME").Value = null;

 

I hope this helps!

View answer in original post

6 REPLIES 6

Mike_Walkuski
Employee
Employee

Hi Mike,

You should be able to do this just by setting the field to null. Your syntax will look something like this.

Screen.CurrentView.Fields("RELATIONSHIPATTRIBUTENAME").Value = null;

 

I hope this helps!

That's what i would have expected and did try the above with nothing happening. Here's my client side coding - 

var r = confirm("ALERT!\nPress 'OK' if you would like to Reassign Dept. & Prodct.\nPlease delete current assignee.");
if (r == true) {
Screen.CurrentView.Fields("ReferralDepartment").focus();
Screen.CurrentView.Fields("ReferralDepartment").ShowLookupButton=true;
Screen.CurrentView.Fields("ReferralProduct").ShowLookupButton=true;
Screen.CurrentView.Fields("ReferralDepartment").ShowLabel=false;
Screen.CurrentView.Fields("ReferralProduct").ShowLabel=false;
Screen.CurrentView.Fields("ReferralDepartment").ReadOnly=false;
Screen.CurrentView.Fields("ReferralProduct").ReadOnly=false;
Screen.CurrentView.Fields("EmployeeFullName").value=null;
$('.HideTable4').show();
$('.HideTable5').hide();
} else {
}

That appears to be correct. Are you positive that you are entering the if statement? If you add an alert right before that line to set it to null, does it display?

Another test would be to just have that line to set it to null and build on that to see if something else is breaking it.

 

Hey Mike,

Try changing the "value" property to upper case. Screen.CurrentView.Fields("EmployeeFullName").Value=null;

Maybe this will solve your problem.