2nd posting - Enabling Checkbox through Formula

I have a DB which when you run a script from there it will automatically setup your new email and create a new locations page.

what I want to do now is turn on the replication section on the locations page. The issue I’m having is no matter what coding I’m entering to get the checkbox checked for “ReplicationEnabled” checkbox, it does not want to put a checkmark.

I’ve tried the postings that I have found here but with no help.

I’ve tried the following:

FIELD ReplicationEnabled := ReplicationEnabled;

@SetField(ReplicationEnabled; “1”)

FIELD ReplicationEnabled := ReplicationEnabled;

@SetField(ReplicationEnabled; “Replication is enabled for this location”)

FIELD ReplicationEnabled := “Replication is enabled for this location”)

I can get the value changed to what is listed in the Checkbox, but the actual checkmark doesn’t appear at all and thus the rest of the fields are still hidden…Yet the value is the correct one (i.e. “1”).

If this needs to be done in scripting then I can create and agent to run, but I may need some assistance with this.

Thanks

Edmound

Subject: 2nd posting - Enabling Checkbox through Formula

where exactly are you making these changes? Somebody else correct me if I am wrong but if you want to have replication enabled in all location docs that get created when a user is setup you’d need to modify the Default Value of ReplicationEnabled field on the Location form in pernames.ntf then place the modified template in your install program.

Subject: RE: 2nd posting - Enabling Checkbox through Formula

Well that way won’t work. I’ve seen this done before, in scripting, but alas I didn’t keep the coding to see how it can be done.

Now the value I can change, but it doesn’t update the foreground area by putting a checkmark on the field. I checked the Input Validation of the replicationEnabled field and this is what it states:

FIELD ReplicationEnabled:=@If(ReplicationEnabled=“”;“0”;ReplicationEnabled);

ReplicationEnabled

If someone can guide me as to what I need to do to be able to complete my programming. If I need to do scripting then so be it, but if I can get some assistance on this it would be a great help.

Thanks!

Edmound

Subject: RE: 2nd posting - Enabling Checkbox through Formula

I guess I am not understanding exactly what you are trying to do. It sounds like when a user is setup for the first time you want local replication enabled by default when the location docs are created. If so then modifying the pernames.ntf as I suggested will do what you want. There is no scripting required, all you’re doing is changing the Default Value in the field on the form, as I described in my previous response.

Subject: 2nd posting - Enabling Checkbox through Formula

Tried the following, works fine.FIELD ReplicationEnabled:=“1”;

And oh, for using @SetField, the field name has to be in quotes i.e.

@SetField(“ReplicationEnabled”;“1”);

cheers!!

Ashish

Subject: RE: 2nd posting - Enabling Checkbox through Formula

To answer to both - Paul that would be fine except we have thousands already out in the field and we are setting up Generic emails on already existing workspaces. Hench right now that wouldn’t work.

Ashish - Thanks for the coding, strange you mentioned that it worked, yet when I tried it the checkmark didn’t appear. I tried this just as a tester:

@Command([Compose]; “”:“names.nsf”; “Location”);

FIELD ReplicationEnabled:=ReplicationEnabled;

@Command([EditGotoField]; “ReplicationEnabled”);

@Prompt([Ok]; “”; @GetField(“ReplicationEnabled”));

@If(ReplicationEnabled = “1”;@SetField(“ReplicationEnabled”; “0”); @SetField(“ReplicationEnabled”; “1”));

@Prompt([Ok]; “”; @GetField(“ReplicationEnabled”))

The Prompts show me that the value, even though it is not checked off it set to one. So the IF statement changes the value to 0 and the Prompt comfirms this. So the value isn’t the issue since I can change it and it does show, but that darn checkmark doesn’t want to display itself. Even if I do a @Command(ViewRefreshFields), it doesn’t display.

Any thoughts?

Subject: RE: 2nd posting - Enabling Checkbox through Formula

Where does the code you posted reside? If you’ve got the code in a button in another database, the replicationenabled field is getting set in the document where the button resides, not on the new location doc you’re creating. This is because that’s where the focus of the button is. In order for the field on the location doc to get set you button (or code) would need to be on the location doc getting created. I think you’re going to need to use LotusScript to achieve the result you desire.

Sub Click(Source As Button)

Dim ns As New NotesSession

Dim ws As New NotesUIWorkspace

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim uidoc As NotesUIDocument

Set db = ns.GetDatabase("", "names.nsf")

Set doc = db.CreateDocument

doc.Form = "Location"

doc.ReplicationEnabled = "1"

Call ws.EditDocument(True, doc)

Set uidoc = ws.CurrentDocument

Call uidoc.GotoField("ReplicationEnabled")

End Sub

Subject: RE: 2nd posting - Enabling Checkbox through Formula

Hey Paul,

Interesting I didn’t know about that about the focus…I love it! Learn something new. Thanks for the coding. It will help me get to where I need to go. It worked perfectly.

Thanks again.

Subject: RE: 2nd posting - Enabling Checkbox through Formula

As an alternative to Paul’s script, you could also use the formula function

@UpdateFormulaContext

after composing your new document. The rest of your formula will then apply to the new document, not the one were the button resides.

Subject: RE: 2nd posting - Enabling Checkbox through Formula

Brook:

Is that a new function? If so, what version did it begin in? I have 6.5.1 help file but do not see that function. I am curious about it. Thx!

Subject: RE: 2nd posting - Enabling Checkbox through Formula

Sorry - can’t tell you exactly which point release it first appeared in, but I suspect it was 6.0.

  • It’s in my 7.0.2 help with a note that it was new in 6

  • It was in the 5 → 6 app dev certification upgrade exam

  • There are references in this forum as far back as Nov 04

I don’t know why it is not in your 6.5.1 help file. Strange.

hth

Michelle