0
votes

I am attempting to replace my 'traditional Notes' User Name and Password Request form with one designed in XPages, mainly because the @SendMail Formula no longer works with Firefox or Chrome.

Anonymous users are to complete an XPage Form, hit a submit button which then sends an email to our support team, which is to include a Doc Link back to an internal Notes form of the same document, - I don't want to change this internal form as there is lots of lotusscript programming associated with it for processing.

I have the XPage marked as Available to Public Access as is the form associated with it. I also have ComputeWithForm set to both.

I can access the data document components e.g. append to the mail rtf body using doc.getItemValueString("field"), but I cannot do the same with appendDocLink it appears to fail due to access problems. If I set Anonymous to Manager access in the ACL the Doc link is appended.

<xp:button value="Submit" id="button1" style="margin-top:50.0px">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete" immediate="false" save="false" id="eventHandler1">
<xp:this.action>
<xp:actionGroup>
<xp:saveDocument var="document1"></xp:saveDocument>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript: if(document1.isNewNote()){document1.save();}
var doc:NotesDocument = document1.getDocument(true);
var receiverEmail = "Support Requests"; 
var requestor = "[email protected]"; 
db = sessionAsSignerWithFullAccess.getCurrentDatabase();
var memo = db.createDocument()
memo.appendItemValue("Form","Memo");
memo.appendItemValue("Principal","Company@NotesDomain");
memo.appendItemValue("From",requestor);
memo.appendItemValue("INetFrom",requestor);
memo.appendItemValue("DisplaySent",requestor);
memo.appendItemValue("SMTPOriginator",requestor);
memo.appendItemValue("Subject","NEW: Name & Password Request for "+getComponent("reqCompany1").getValue());
var rtitem:NotesRichTextItem = memo.createRichTextItem("Body");
rtitem.addNewLine();
rtitem.appendText("A new Name & Password Request has been logged by "+getComponent("reqFirstName1").getValue()+" " + getComponent("reqSecondName1").getValue()+" of "+ getComponent("reqCompany1").getValue());
rtitem.addNewLine();
rtitem.appendText("Click the Doc link to action it. ");
rtitem.appendDocLink(doc);
memo.send(receiverEmail);}]]></xp:this.script>
                                </xp:executeScript>
                                <xp:openPage name="/UserNandPSubmitted.xsp"></xp:openPage>
                            </xp:actionGroup>
                        </xp:this.action>
                    </xp:eventHandler>
                </xp:button>

The following errors occur.

com.ibm.jscript.InterpretException: Script interpreter error, line=25, col=8: [TypeError] Exception occurred calling method NotesRichTextItem.appendDocLink(lotus.domino.local.Document) null

NotesException: Notes error: You are not authorized to perform that operation lotus.domino.local.RichTextItem.appendDocLink(Unknown Source) lotus.domino.local.RichTextItem.appendDocLink(Unknown Source)

Any help would be greatly appreciated.

1
By the way - another option is to call your code with sessionAsSigner.Frantisek Kossuth
@Frantisek I tried that, as in the code above and it didn't work Frantisek, have I correctly understood?Mark Maden
It should work. Probably signature problem? stackoverflow.com/a/21107992/206265 Or - and that can be question to IBM, appendDocLink does not count with signer session, who knows...Frantisek Kossuth

1 Answers

1
votes

Make sure Anonymous user can access the default view of the database - so make it accessible to public access users. appendDocLink() method requires this view in order to append doc link to RT item.