Just glancing at it quickly, it appears the Tasks_SelectPerson_OLD script is munged up. The If statement chooses between two branches that do the same thing. I'd start there. (I also expect the "pr" is a Script Parameter, but it may be a field as well; check to see where that's being set - or not.)
Hi Mike, yes the "pr" is a parameter that if the checkbox is selected it uses the "email" as the value to select email as a send option.
I removed from the second portion of the If statement the "|1" part of it and it now only highlights the name if the name is selected and not the checkbox.
See image below is I select the name only now:
Now if I select the checkmark, I get this:
As you can see the checkbox does not get a chekmark.
Since the field has been turned into a button, and that button executes a script, and that script takes the focus out of the field, the checkbox is never activated.
The script needs to set the field containing the checkbox to whatever value the checkbox is set to. Go into layout mode and find out what value list is being used. Then add a Set Field script step to set the field to that value.
I once tried using a set field, but what happens is that the chackmark appears on the viewing of another user using the same layout even when on a different client is being written/edited on. Maybe I am adding it on the wrong place?
How is the calculation determined? That's what you need to update in order for the checkbox to show checked.
That means the value in cc_AccountName|1 has to be present in _kf_AccountNames for the checkbox to be checked. What is the script that fires when you click the checkbox? Tasks_SelectPerson_OLD? That appears to try to add a value to the foreign key using what is apparently either a custom function or a plugin function (AddValues), but it's not the same value.
What you need to do is go back and figure out how cc_AccountName|1 is related to Tasks_AllEmployees::AccountName. In order to diagnose what's going on, you'll have to go through the Relationships Graph from the context of this layout and run down what those values are from the point of view of the related record when you click the checkbox. Something is probably breaking there.
I suggest turning on the Script Debugger and Data Viewer (if you have Advanced) and inspecting the various values as the script is running. If not, you can insert Custom Dialogs into the script at various points and have FileMaker report on what the values are as you're proceeding.
Here is another approach you could try. I have used a "checkbox" system for a similar task, as far as I can tell from your post. My technique is as follows:
• the "checkbox" field is simply a text field with no checkboxes, but set square to a few points in size
• to format the field you can use whatever effects appeal to your eye, and conditional formatting based on content so it is visually different when checked
• the field is formatted as a button which runs a simple script to set itself to "X" if empty, or empty if already set to "X"
see attached screenshot:
I will make a copy of my layout and try-out your suggestion. Will keep you posted.
This is not something I can diagnose by remote with screen shots. You're going to have to go back and do what I said before: Step through the script, either with the Debugger or with scripted pauses, and figure out what's going on.
The two fields in that calculation are the key. Find out how they're being manipulated through the scripting. That will give you your answer.
I ran both the Debugger & data View.
I noticed a certain field is not referenced.
See pic below:
I noticed that field name: "cc_sendNoteEmail" is a calculation. the coding states:
If(PatternCount(Notes::kf_AccountNames; cc_AccountName|1); "1")
I noticed that the highlighted "cc_AccountName|1" is being referenced in that calculation, but it is not referenced anywhere. Is there a way to check where this field is being referenced or used in layouts or scripts?
Also, I noticed in the table that it has a calculation field as well: Unstored, from z_Employees, = AccountName & "|1"
That is what I noticed.
I tried google to see what the patterncount" code does, but I am unfamiliar with it.
I am clueless in what it is doing.
It is probably because of that that i do not know what's going on with that code.