EffectiveUserName problem

Hi,

Bit of a strange problem with my web agent. I am trying to sign the section on the form completed by the user, but it seems to be putting the name of the person who signed the agent instead!?!?

Can anyone help me out getting this working?

Code :

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim status As Integer

Dim nam As NotesName

Dim strContract As String

Dim StrItemNo As String

Dim strJobNo As String

Dim QtyChecked As String



On Error Goto errorHandling



Set db = session.CurrentDatabase

Set doc = session.DocumentContext

Set nam = session.CreateName(session.EffectiveUserName)

status = Cint(doc.status(0))

strContract = doc.ContractCode(0)

strItemNo = doc.JobItemNo(0)

strJobNo = doc.JobOrdNo(0)



If status = 0 Then

	'New Doc - so set status to 5

	doc.status = 5

	'Since this is a new document - run the number generator to gen a number for the RIR

	doc.RIRNum = NumberGenerator(strContract,strItemNo,strJobNo)

	Call doc.save(True,True)

	Call HTMLEmailInspector(session, db, doc)

	Exit Sub

End If



If status = 5 Then

	If doc.InspComplete(0) = "Yes" Then

	'QA section - set status to 10

		doc.status = 10

		doc.InspSigned = nam.Abbreviated

		doc.InspSigDate = Now

		Call doc.Save(True,True)

		Call HTMLEmailLeadEng(session, db, doc)

		Exit Sub

	Else

		Exit Sub

	End If

End If



If status = 10 Then

	'Relase for Manufacture - set status to 15

	If doc.QComplete(0) = "Yes" Then

		doc.DocSigned = nam.Abbreviated

		doc.DocSigDate = Now

		doc.status = 15

		Call doc.Save(True,True)

		Exit Sub

	Else

		Exit Sub

	End If

End If



If status = 15 And doc.RFMQComplete(0) = "Yes" Then

	'Release for manufacture - stores - set status to 20

	doc.status = 20

	doc.RelSigned = nam.Abbreviated

	doc.RelSigDate = Now

	Call doc.save(True,True)

	Call HTMLEmailStoreman(session, db, doc)

	Call HTMLEmailTransporter(session, db, doc)

	Exit Sub

End If



If status = 20 Then

	'Close Off - Status 21

	doc.status = 21

	doc.StoreSig = nam.Abbreviated

	doc.StoreSigDate = Now

	doc.RIRClosed = "Yes"

	doc.ClosedBy = nam.Abbreviated

	doc.DateClosed = Now

	Call doc.save(True,True)

	Call HTMLEmailPlanning(session, db, doc)

	Call HTMLEmailLeadEngInfoOnly(session, db, doc)

	Exit Sub

End If

errorHandling:

Print "Workflow-RIR Error Reports:"     

Print Err & " " & Error$

Print "Error Generator Failed" & Chr$(13) & Chr$(10)

Print "Doc Type: " & doc.DocType(0)  & Chr$(13) & Chr$(10)

Print "RIR No: " & doc.RIRNum(0)  & Chr$(13) & Chr$(10)

Print session.EffectiveUserName

Exit Sub

End Sub

Help is appreciated.

F1H

Subject: EffectiveUserName problem

Hello Friend,

Please check designer help for EffectiveUserName property

i.e.

For a script running on:

1> A workstation, this is the name of the current user.

2 > A server, this is the name of the script’s owner (the person who last saved the script).

3> The Web, this is the either the name of the current Web user (if the Run as web user property is checked in the Agent Properties box) or the name of the person who last saved the script.

Hope this answer your issue…

– Parikshit

Subject: RE: EffectiveUserName problem

Thank You!

Its working now…I havdn’t checked that ‘Run as Web User’ option in the properties, so it was just running it on behalf of the script owner!!

Thanks again for your help.

F1H