Invalid universal Id;4091;762

Haiwhen I clik a button a mail will be sent to all the users my mail as a link but before my mail has been sent on getting a error as Invalid universal Id;4091;762 I have checked my code every thoing is ok but i dont know where iam getting the errorcan any one please help me in this issue why iam getting this error

On Error Goto error1

Dim session As New NotesSession

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim nam As NotesName

Dim nam1 As NotesName

Dim sendstr As String

Dim sto As NotesDateTime

Dim db1 As New NotesDatabase("GM_LN03/RIL","CRMgmtTrcking.nsf")

Dim parentdoc As NotesDocument

Dim item As NotesRichTextItem

Dim tempdoc As NotesDocument

Dim db As NotesDatabase

'Dim chk1 As New NotesDateTime(Now)

Dim chk1 As NotesDateTime



resul = Evaluate( |@Now([ServerTime])|)

Set chk1 = New NotesDateTime(resul(0))

Dim view As NotesView

Dim prio As Variant

Dim  cat_s As String

Dim i As Integer 

Dim m As Integer

Dim mn As Integer

Dim str66 As String

Dim append4 As Variant

Dim v As Integer

Dim concat As Variant

Dim mailsub As String

Dim str10 As String

Dim str1 As String

Dim str2 As String

Dim str4 As String

Dim str5 As String

Dim str6 As String

Dim str7 As String

Dim str8 As String

Dim str9 As String

Dim w As Integer

Dim mailmes As String

Dim mailremarks As String

Set db = session.CurrentDatabase

Set uidoc=ws.CurrentDocument

Set doc=uidoc.Document		

Dim view1 As NotesView

Set view1 = db.GetView("Escalation_ Details")

Dim tempdoc1 As NotesDocument

Dim Targetdb As New NotesDatabase("INFWDOC060/SVR/RIL","EffortTracker\TMSPROJE.nsf")



Dim Targetdoc As NotesDocument

Set Targetdoc = Targetdb.CreateDocument



Dim j As Integer

If uidoc.EditMode=False Then

	uidoc.EditMode=True

End If





'**********************Fixing of Default date For Sag*****************

If(doc.getitemvalue("Sys")(0)="Multiple") Then 

	

	Call doc.ReplaceItemValue("sdate",Format$(chk1.DateOnly,"dd/mm/yyyy"))

	'Call uidoc.FieldSetText("sdate",Format$(chk1.DateOnly,"dd/mm/yyyy"))

	'Dim prio As Variant

	'Dim  cat_s As String

	'Dim concat As Variant

	Set view = db.GetView("Copy Of SAG EscView")

	prio =uidoc.FieldGetText("priority")

	cat_s = uidoc.FieldGetText("cat_sev")

	concat = prio + cat_s

	Set tempdoc = view.GetDocumentByKey(concat,True)

	

	If (tempdoc Is Nothing) Then

	Else	

		Set sto = New NotesDateTime(chk1.DateOnly)

	'Msgbox sto.DateOnly

	'Set sto =New NotesDateTime(uidoc.FieldGetText("sdate"))

		Call sto.AdjustDay(tempdoc.GetItemValue("TimeE")(0))

	'Msgbox sto.DateOnly

	'Msgbox Format$(sto.DateOnly,"mm/dd/yyyy")

		'Call uidoc.FieldSetText("edate",Format$(sto.DateOnly,"dd/mm/yyyy"))  '*******Fixing of enddate starting date+escdate from sag master

		Call doc.ReplaceItemValue("edate",Format$(sto.DateOnly,"dd/mm/yyyy")) 

	End If

	'Call doc.Save(True,False)

'End If

'Date*************

'************************************Fixing Of Default Date For Development**********************

%REM

If(doc.getitemvalue("Sys")(0)="Single") Then 

	'Dim chk1 As New NotesDateTime(Now)

	'Dim view As NotesView

	Call uidoc.FieldSetText("sdat",Format$(chk1.DateOnly,"dd/mm/yyyy"))

	'Dim prio As Variant

	 'Dim  cat_s As String

	'Dim concat As Variant

	Set view = db.GetView("Copy Of SAG EscView")

	prio =uidoc.FieldGetText("priority")

	cat_s = uidoc.FieldGetText("cat_sev")

	concat = prio + cat_s

	Set tempdoc = view.GetDocumentByKey(concat,True)

	If (tempdoc Is Nothing) Then

	Else	

		Set sto = New NotesDateTime(chk1.DateOnly)

	'Msgbox sto.DateOnly

	'Set sto =New NotesDateTime(uidoc.FieldGetText("sdate"))

		Call sto.AdjustDay(tempdoc.GetItemValue("TimeE_1")(0))

	'Msgbox sto.DateOnly

	'Msgbox Format$(sto.DateOnly,"mm/dd/yyyy")

		Call uidoc.FieldSetText("edat",Format$(sto.DateOnly,"dd/mm/yyyy"))  '*******Fixing of enddate starting date+escdate from sag master

		

	End If

	'Call doc.Save(True,False)

End If

%END REM

'*****************************************End***************************************

	

	'flag=ws.DialogBox("Reviewer Note", True ,True ,True,,,,"Reviewer Note")

%REM

Dim chkresult As Boolean

chkresult=ws.Prompt(PROMPT_YESNO,"Option","Do you want to attach file with this link?")	

If chkresult=True Then

	Dim more As Boolean

	more=True

	While more=True

		Call addattach(uidoc,"result4")	

		more=ws.Prompt(PROMPT_YESNO,"Option","Do you want to attach more files?")	

	Wend

	

End If

%END REM

'*************************************Sending mail to head************************

	Dim vview As NotesView

	Dim vdoc As NotesDocument

	Dim vstr As String

	Set vview = db.GetView("San_business")

	vstr =doc.GetItemValue("business")(0)

	Set vdoc = vview.GetDocumentByKey(vstr)

'**********************************************End***************************************

'*************************************Sending mail to Requestor head************************

%REM

Dim vview1 As NotesView

Dim vdoc1 As NotesDocument

Dim vstr1 As String

Set vview1 = db.GetView("Master_sag")

vstr1 =doc.GetItemValue("Sag_Name")(0)

Set vdoc1 = vview1.GetDocumentByKey(vstr1)

%END REM

'**********************************************End**************************************

'Dim result As Boolean

	Dim result As String

	result=ws.Prompt(PROMPT_YESNOCANCEL,"Option","Do you want to send this link to more people?")

	

	If result=1Then

		

		Call uidoc.FieldSetText("Status","Under Analysis")

		Call uidoc.FieldSetText("FinanceStatus","AwaitingApproval")

		

		Call uidoc.FieldSetText("cr_prep",session.CommonUserName)

		Call uidoc.FieldSetText("cr_prep_1",session.CommonUserName)

		Call uidoc.FieldSetText("prep_time",Format$(chk1.DateOnly,"dd/mm/yyyy"))

		Call uidoc.FieldSetText("prep_time_1",Format$(chk1.DateOnly,"dd/mm/yyyy"))

		

	'	Call ws.DialogBox("Namelist", True ,True,True,,,, "Please select the names from address book.")

		

		Call uidoc.save

		

	'	Call ws.DialogBox("Namelist", True ,True ,True,,,,"Please select the names from address book.")

		

		Call ws.DialogBox("Copy Of Namelist", True ,True,True,,,, "Please select the names from address book.")

		

		

	'Dim mailsub As String

	'Dim mailmes As String

	 'Dim mailremarks As String

		

		mailsub="CR No: "+ uidoc.FieldGetText("F3") +" , is Raised."

		mailmes = "CR No: "+ uidoc.FieldGetText("F3") +" "+ " ,has been raised." & _

		Chr(10) & " " & _

		Chr(10) & "Kindly PROVIDE / APPROVE the details in – Functional Impact & Impact Analysis section of the CR Document attached herewith." + ""  & _ 

		Chr(10) & " " & _

		Chr(10) & "Also, Request you to prepare the ''System/Software Requirement Specification'' for the same." & _

		Chr(10) & " " & _

		Chr(10) & "The CR document link has been attached herewith for your reference."

		

		

		mailremarks=uidoc.FieldGetText("ReviewerNote")

			'*****************for BR Attachment Viewing**********

		

		

		Set parentdoc = db1.GetDocumentByUNID _

		( doc.ParentDocumentUNID )

		Set item =parentdoc.GetFirstItem("brs_att")

	'	Msgbox (item)

		

		Call doc.CopyItem(item,"brs_att")

		Call ws.EditDocument(False,doc)

		

		Call doc.Save(True,False)

		

		'*****************************************************

	'End If

		

		

	'Call AppendHist(doc,"CR Prepared",sendstr) 

	'If vdoc Is Nothing Then

	'Else

		Set nam = New NotesName(uidoc.FieldGetText("T"))

		Set nam1= New NotesName(uidoc.FieldGetText("cc"))

	'Call doc.ReplaceItemValue("cr_evt_t",nam.Common)

	'Call doc.ReplaceItemValue("cr_evt_cc",nam1.Common)

		

	'Msgbox nam.common

		'str1= doc.GetItemValue("cr_request")(0) +";"+ vdoc.GetItemValue("Bhead")(0) +";"+ nam.Common

		

		'For m=0 To Ubound(tempdoc.Lhead)

		For m=0 To Ubound(uidoc.document.GetItemValue(Lhead))

			If str6 ="" Then

				'str6=tempdoc.Lhead(m)

				str6=uidoc.document.Lhead(m)

			Else

				'str6 = str6+";"+tempdoc.Lhead(m)

				str6 = str6+";"+uidoc.document.Lhead(m)

			End If

		Next

		For w=0 To Ubound(doc.BA)

			If str8 ="" Then

				str8=doc.BA(w)

			Else

				str8 = str8+";"+doc.BA(w)

			End If

		Next

		'**********Multiple value in cc field**********

		For mn=0 To Ubound(doc.cc)

			If str66 ="" Then

				str66=doc.cc(mn)

			Else

				str66 = str66+";"+doc.cc(mn)

			End If

		Next

		'***************************

		str1=uidoc.FieldGetText("T")+";"+str8+";"+ str6+";"+tempdoc.GetItemValue("Fhead")'************mail to SAG is Pending

	'Msgbox str1

		str2= str66+";"+doc.GetItemValue("PMn")(0)+";"+doc.GetItemValue("SDM")(0)+";"+doc.GetItemValue("cr_request")(0)+";"+doc.GetItemValue("FinanceApprover")(0)	

		append3 =Arrayunique(Split( str1,";"),0)

		If  str1<>"" Then

			For i=0 To Ubound(append3) 

				If str4 ="" Then

					Set nam = New NotesName(append3(i))

					str4= str4+nam.Common

					

				Else

					Set nam = New NotesName(append3(i))

					str4= str4+";"+nam.Common

				End If	

			Next

		End If

		

		append4 =Arrayunique(Split( str2,";"),0)

		If  str2<>"" Then

			For i=0 To Ubound(append4) 

				If str5 ="" Then

					Set nam = New NotesName(append4(i))

					str5= str5+nam.Common

					

				Else

					Set nam = New NotesName(append4(i))

					str5= str5+";"+nam.Common

				End If	

			Next

		End If

		

		

		Call doc.ReplaceItemValue("raise_evt",session.CommonUserName)

		Call doc.ReplaceItemValue("R",Format$(chk1.DateOnly,"dd/mm/yyyy")+" "+chk1.TimeOnly)

		Call doc.ReplaceItemValue("cr_evt_t",str4)

		Call doc.ReplaceItemValue("cr_evt_cc",str5)

		Call doc.Save(True,False)

		Call mailsend(uidoc,str4,str5,"",mailsub, mailmes,mailremarks,"","","",False)

		

			'******************for Tms*************************

		

		

		Targetdoc.form = "ImportData"

		Call Targetdoc.ReplaceItemValue("CR_BRnO",doc.GetItemValue("doc_id1")(0))

		Call Targetdoc.ReplaceItemValue("business",doc.GetItemValue("business_1")(0))

		Call Targetdoc.ReplaceItemValue("Projecttitle",doc.GetItemValue("title")(0)) 

		Call Targetdoc.ReplaceItemValue("status",doc.GetItemValue("Status_1")(0)) 

		Call Targetdoc.Save(True,False)

		

		

		'***************************************************

		If uidoc.FieldGetText("T")="" Then

			sendstr=""

			str1=str8+";"+str6+";"+tempdoc.GetItemValue("Fhead")(0)

			append3 =Arrayunique(Split( str1,";"),0)

			If  str1<>"" Then

				For i=0 To Ubound(append3) 

					sendstr=" and assigned to - " + append3(i)

					Call AppendHist(doc,"CR Prepared",sendstr) 

				Next

			End If

		Else

			sendstr=""

		'str1=uidoc.FieldGetText("T")+";"+doc.GetItemValue("BA")(0)+";"+tempdoc.GetItemValue("Lhead")(0)+";"+tempdoc.GetItemValue("Fhead")(0)

			append3 =Arrayunique(Split( str4,";"),0)

			For i=0 To Ubound(append3) 

				sendstr=" and assigned to - " + append3(i)

				Call AppendHist(doc,"CR Prepared",sendstr) 

			Next

			

		End If

		

		If uidoc.FieldGetText("cc")="" Then

			sendstr=""

			str2=doc.GetItemValue("PMn")(0)+";"+doc.GetItemValue("SDM")(0)+";"+doc.GetItemValue("cr_request")(0)+";"+doc.GetItemValue("FinanceApprover")(0)	

			append3 =Arrayunique(Split( str1,";"),0)

			append4= Arrayunique(Split(str2,";"),0)

			If str2<>"" Then

				For i=0 To Ubound(append4) 

					sendstr=" and sent a CC to - " + append4(i)

					Call AppendHist(doc,"CR Prepared",sendstr) 

				Next

			End If

		Else

			sendstr=""

			str2=uidoc.FieldGetText("cc")+";"+doc.GetItemValue("PMn")(0)+";"+doc.GetItemValue("SDM")(0)+";"+ doc.GetItemValue("cr_request")(0)+";"+doc.GetItemValue("FinanceApprover")(0)	

			append3 =Arrayunique(Split( str1,";"),0)

			append4= Arrayunique(Split(str5,";"),0)

			For i=0 To Ubound(append4) 

				sendstr=" and sent a CC to - " + append4(i)

				Call AppendHist(doc,"CR Prepared",sendstr) 

			Next

		End If

	'Call uidoc.FieldSetText("SaveOptions","0")

		Msgbox "Your request has been sent for review",64,"Message"

		Call uidoc.Close

	'End If

		

	'Call mailsend(uidoc,uidoc.FieldGetText("SDPM"),uidoc.FieldGetText("cc"),"",mailsub, mailmes,mailremarks,"","","",False)

	Elseif result = False Then

		Call uidoc.FieldSetText("Status","Under Analysis")

		Call uidoc.FieldSetText("FinanceStatus","AwaitingApproval")

		

		Call uidoc.FieldSetText("cr_prep",session.CommonUserName)

		Call uidoc.FieldSetText("cr_prep_1",session.CommonUserName)

		Call uidoc.FieldSetText("prep_time",Format$(chk1.DateOnly,"dd/mm/yyyy"))

		Call uidoc.FieldSetText("prep_time_1",Format$(chk1.DateOnly,"dd/mm/yyyy"))

		

		Call uidoc.Save

		

		mailsub="CR No: "+ uidoc.FieldGetText("F3") +" , is Raised."

		mailmes = "CR No: "+ uidoc.FieldGetText("F3") +" "+ " ,has been raised." & _

		Chr(10) & " " & _

		Chr(10) & "Kindly PROVIDE / APPROVE the details in – Functional Impact & Impact Analysis section of the CR Document attached herewith." + ""  & _ 

		Chr(10) & " " & _

		Chr(10) & "Also, Request you to prepare the ''System/Software Requirement Specification'' for the same." & _

		Chr(10) & " " & _

		Chr(10) & "The CR document link has been attached herewith for your reference."

		

		

		mailremarks=uidoc.FieldGetText("ReviewerNote")

		'*************FOR Attachment of BR***********

		

		Set parentdoc = db1.GetDocumentByUNID _

		( doc.ParentDocumentUNID )

		Set item =parentdoc.GetFirstItem("brs_att")

		

		

		Call doc.CopyItem(item,"brs_att")

		Call ws.EditDocument(False,doc)

		

		Call doc.Save(True,False)

		

		'*****************************************************

		

		'For m=0 To Ubound(tempdoc.Lhead)

		For m=0 To Ubound(uidoc.document.GetItemValue(Lhead))

			If str6 ="" Then

				'str6=tempdoc.Lhead(m)

				str6=uidoc.document.Lhead(m)

			Else

				'str6 = str6+";"+tempdoc.Lhead(m)

				str6 = str6+";"+uidoc.document.Lhead(m)

			End If

		Next

		For w=0 To Ubound(doc.BA)

			If str8 ="" Then

				str8=doc.BA(w)

			Else

				str8 = str8+";"+doc.BA(w)

			End If

		Next

		str1=str8+";"+str6+";"+tempdoc.GetItemValue("Fhead")(0)

		str2=doc.GetItemValue("PMn")(0)+";"+doc.GetItemValue("SDM")(0)+";"+ doc.GetItemValue("cr_request")(0)+";"+doc.GetItemValue("FinanceApprover")(0)	

		'Msgbox str2

		Call doc.ReplaceItemValue("raise_evt",session.CommonUserName)

		Call doc.ReplaceItemValue("R",Now)

		Call doc.ReplaceItemValue("cr_evt_t",str1)

		Call doc.ReplaceItemValue("cr_evt_cc",str2)

		Call mailsend(uidoc,str1,str2,"",mailsub, mailmes,mailremarks,"","","",False)

			'******************for Tms*************************

		

		

		Targetdoc.form = "ImportData"

		Call Targetdoc.ReplaceItemValue("CR_BRnO",doc.GetItemValue("doc_id1")(0))

		Call Targetdoc.ReplaceItemValue("business",doc.GetItemValue("business_1")(0))

		Call Targetdoc.ReplaceItemValue("Projecttitle",doc.GetItemValue("title")(0)) 

		Call Targetdoc.ReplaceItemValue("status",doc.GetItemValue("Status_1")(0)) 

		Call Targetdoc.Save(True,False)

		

		

		'***************************************************

		sendstr=""

		append3 =Arrayunique(Split( str1,";"),0)

		If  str1<>"" Then

			For i=0 To Ubound(append3) 

				sendstr=" and assigned to - " + append3(i)

				Call AppendHist(doc,"CR Prepared",sendstr) 

			Next

		End If

		append4= Arrayunique(Split(str2,";"),0)

		If str2<>"" Then

			For i=0 To Ubound(append4) 

				sendstr=" and sent a CC to - " + append4(i)

				Call AppendHist(doc,"CR Prepared",sendstr) 

			Next

		End If

		

		

		

	'Call mailsend(uidoc,uidoc.FieldGetText("SDPM"),uidoc.FieldGetText("cc"),"",mailsub, mailmes,mailremarks,"","","",False)

	'Call uidoc.FieldSetText("SaveOptions","0")

	'Call uidoc.Close

	'Exit Sub

		

		Call uidoc.FieldSetText("SaveOptions","0")

	'Msgbox "Your request has been sent for review",64,"Message"

		Call uidoc.Close

		Exit Sub

	End If

Elseif (doc.getitemvalue("Sys")(0)="Single") Then 

	

	Call doc.ReplaceItemValue("sdate",Format$(chk1.DateOnly,"dd/mm/yyyy"))

	'Call uidoc.FieldSetText("sdate",Format$(chk1.DateOnly,"dd/mm/yyyy"))

	'Dim prio As Variant

	'Dim  cat_s As String

	'Dim concat As Variant

	Set view = db.GetView("Copy Of SAG EscView")

	prio =uidoc.FieldGetText("priority")

	cat_s = uidoc.FieldGetText("cat_sev")

	concat = prio + cat_s

	Set tempdoc = view.GetDocumentByKey(concat,True)

	If (tempdoc Is Nothing) Then

	Else	

		Set sto = New NotesDateTime(chk1.DateOnly)

	'Msgbox sto.DateOnly

	'Set sto =New NotesDateTime(uidoc.FieldGetText("sdate"))

		Call sto.AdjustDay(tempdoc.GetItemValue("TimeE")(0))

	'Msgbox sto.DateOnly

	'Msgbox Format$(sto.DateOnly,"mm/dd/yyyy")

		'Call uidoc.FieldSetText("edate",Format$(sto.DateOnly,"dd/mm/yyyy"))  '*******Fixing of enddate starting date+escdate from sag master

		Call doc.ReplaceItemValue("edate",Format$(sto.DateOnly,"dd/mm/yyyy")) 

	End If

	'Call doc.Save(True,False)

'End If

'Date*************

'************************************Fixing Of Default Date For Development**********************

%REM

If(doc.getitemvalue("Sys")(0)="Single") Then 

	'Dim chk1 As New NotesDateTime(Now)

	'Dim view As NotesView

	Call uidoc.FieldSetText("sdat",Format$(chk1.DateOnly,"dd/mm/yyyy"))

	'Dim prio As Variant

	 'Dim  cat_s As String

	'Dim concat As Variant

	Set view = db.GetView("Copy Of SAG EscView")

	prio =uidoc.FieldGetText("priority")

	cat_s = uidoc.FieldGetText("cat_sev")

	concat = prio + cat_s

	Set tempdoc = view.GetDocumentByKey(concat,True)

	If (tempdoc Is Nothing) Then

	Else	

		Set sto = New NotesDateTime(chk1.DateOnly)

	'Msgbox sto.DateOnly

	'Set sto =New NotesDateTime(uidoc.FieldGetText("sdate"))

		Call sto.AdjustDay(tempdoc.GetItemValue("TimeE_1")(0))

	'Msgbox sto.DateOnly

	'Msgbox Format$(sto.DateOnly,"mm/dd/yyyy")

		Call uidoc.FieldSetText("edat",Format$(sto.DateOnly,"dd/mm/yyyy"))  '*******Fixing of enddate starting date+escdate from sag master

		

	End If

	'Call doc.Save(True,False)

End If

%END REM

'*****************************************End***************************************

	

	flag=ws.DialogBox("Reviewer Note", True ,True ,True,,,,"Reviewer Note")

%REM

Dim chkresult As Boolean

chkresult=ws.Prompt(PROMPT_YESNO,"Option","Do you want to attach file with this link?")	

If chkresult=True Then

	Dim more As Boolean

	more=True

	While more=True

		Call addattach(uidoc,"result4")	

		more=ws.Prompt(PROMPT_YESNO,"Option","Do you want to attach more files?")	

	Wend

	

End If

%END REM

'*************************************Sending mail to head************************

	

	'Dim vview As NotesView

	'Dim vdoc As NotesDocument

	'Dim vstr As String

	'Set vview = db.GetView("San_business")

	'vstr =doc.GetItemValue("business")(0)

	'Set vdoc = vview.GetDocumentByKey(vstr)

'**********************************************End***************************************

'*************************************Sending mail to Requestor head************************

%REM

Dim vview1 As NotesView

Dim vdoc1 As NotesDocument

Dim vstr1 As String

Set vview1 = db.GetView("Master_sag")

vstr1 =doc.GetItemValue("Sag_Name")(0)

Set vdoc1 = vview1.GetDocumentByKey(vstr1)

%END REM

'**********************************************End**************************************

'Dim result As Boolean

	Dim result1 As String

	result1=ws.Prompt(PROMPT_YESNOCANCEL,"Option","Do you want to send this link to more people?")

	

	If result1=1Then

		str6=Trim(uidoc.FieldGetText("impact_sy1"))

		Set tempdoc1= view1.GetDocumentByKey(str6,True)

		Call uidoc.FieldSetText("Status","Under Analysis")

		Call uidoc.FieldSetText("cr_prep",session.CommonUserName)

		Call uidoc.FieldSetText("cr_prep_1",session.CommonUserName)

		Call uidoc.FieldSetText("prep_time",Format$(chk1.DateOnly,"dd/mm/yyyy"))

		Call uidoc.FieldSetText("prep_time_1",Format$(chk1.DateOnly,"dd/mm/yyyy"))

		

	'Call ws.DialogBox("Namelist", True ,True,True,,,, "Please select the names from address book.")

		

		Call uidoc.save

		

	'Call ws.DialogBox("Namelist", True ,True ,True,,,,"Please select the names from address book.")

		

		Call ws.DialogBox("Copy Of Namelist", True ,True,True,,,, "Please select the names from address book.")

		

		

	'Dim mailsub As String

	'Dim mailmes As String

	 'Dim mailremarks As String

		

		mailsub="CR No: "+ uidoc.FieldGetText("F3") +" , is Raised."

		mailmes = "CR No: "+ uidoc.FieldGetText("F3") +" "+ " ,has been raised." & _

		Chr(10) & " " & _

		Chr(10) & "Kindly PROVIDE / APPROVE the details in – Functional Impact & Impact Analysis section of the CR Document attached herewith." + ""  & _ 

		Chr(10) & " " & _

		Chr(10) & "Also, Request you to prepare the ''System/Software Requirement Specification'' for the same." & _

		Chr(10) & " " & _

		Chr(10) & "The CR document link has been attached herewith for your reference."

		

		

		mailremarks=uidoc.FieldGetText("ReviewerNote")

		'**************FOR Attachment of BR**********

			'*****************for BR Attachment Viewing**********

		

'		doc.ParentDocumentUNID

		If doc.ParentDocumentUNID <> "" Then

			Set parentdoc = db1.GetDocumentByUNID( doc.ParentDocumentUNID )

			Set item =parentdoc.GetFirstItem("brs_att")

			

			

			Call doc.CopyItem(item,"brs_att")

			Call ws.EditDocument(False,doc)

			

			Call doc.Save(True,False)

		End If

		

		'*****************************************************

		'*******************************************

	'End If

		

		

	'Call AppendHist(doc,"CR Prepared",sendstr) 

	'If vdoc Is Nothing Then

	'Else

	'Set nam = New NotesName(uidoc.FieldGetText("T"))

	'Set nam1= New NotesName(uidoc.FieldGetText("cc"))

	'Call doc.ReplaceItemValue("cr_evt_t",nam.Common)

	'Call doc.ReplaceItemValue("cr_evt_cc",nam1.Common)

	'Msgbox uidoc.FieldGetText("T")

	'Msgbox nam.common

	'Msgbox nam1.Common

		'str1= doc.GetItemValue("cr_request")(0) +";"+ vdoc.GetItemValue("Bhead")(0) +";"+ nam.Common

		

	'Msgbox Ubound(tempdoc.Lhead)

		If Not tempdoc1 Is Nothing Then

			For j=0 To Ubound(tempdoc1.FA)

				If str7 ="" Then

					str7=tempdoc1.FA(j)

				Else

					str7 = str7+";"+tempdoc1.FA(j)

				End If

			Next

		End If

		

		For w=0 To Ubound(doc.BA)

			If str8 ="" Then

				str8=doc.BA(w)

			Else

				str8 = str8+";"+doc.BA(w)

			End If

		Next

		'************for multiple value in cc **************************

		

		For mn=0 To Ubound(doc.cc)

			If str66 ="" Then

				str66=doc.cc(mn)

			Else

				str66 = str66+";"+doc.cc(mn)

			End If

		Next

		

		'*********************end*************************

		'uidoc.FieldGetText("cc")

		str1=uidoc.FieldGetText("T")+";"+str8+";"+str7 '************mail to SAG is Pending

		str2= str66+";"+doc.GetItemValue("PMn")(0)+";"+doc.GetItemValue("SDM")(0)+";"+doc.GetItemValue("cr_request")(0)+";"+doc.GetItemValue("FinanceApprover")(0)	

		

	'Set nam = New Notesname(str1)

	'Msgbox nam.Common

		'Msgbox str1

		append3 =Arrayunique(Split( str1,";"),0)

		If  str1<>"" Then

			For i=0 To Ubound(append3) 

				If str4 ="" Then

					Set nam = New NotesName(append3(i))

					str4= str4+nam.Common

					

				Else

					Set nam = New NotesName(append3(i))

					str4= str4+";"+nam.Common

				End If	

			Next

		End If

		append4 =Arrayunique(Split( str2,";"),0)

		If  str2<>"" Then

			For i=0 To Ubound(append4) 

				If str5 ="" Then

					Set nam1 = New NotesName(append4(i))

					str5= str5+nam1.Common

					

				Else

					Set nam1 = New NotesName(append4(i))

					str5= str5+";"+nam1.Common

				End If	

			Next

		End If

		

		

	'Msgbox str4

		Call doc.ReplaceItemValue("raise_evt",session.CommonUserName)

		Call doc.ReplaceItemValue("R",Format$(chk1.DateOnly,"dd/mm/yyyy")+" "+chk1.TimeOnly)

		Call doc.ReplaceItemValue("cr_evt_t",str4)

		Call doc.ReplaceItemValue("cr_evt_cc",str5)

		Call doc.Save(True,False)

		Call mailsend(uidoc,str4,str5,"",mailsub, mailmes,mailremarks,"","","",False)

			'******************for Tms*************************

		

		

		Targetdoc.form = "ImportData"

		Call Targetdoc.ReplaceItemValue("CR_BRnO",doc.GetItemValue("doc_id1")(0))

		Call Targetdoc.ReplaceItemValue("business",doc.GetItemValue("business_1")(0))

		Call Targetdoc.ReplaceItemValue("Projecttitle",doc.GetItemValue("title")(0)) 

		Call Targetdoc.ReplaceItemValue("status",doc.GetItemValue("Status_1")(0)) 

		Call Targetdoc.Save(True,False)

		

		

		'***************************************************

		If uidoc.FieldGetText("T")="" Then

			sendstr=""

			str1=str8+";"+str7

			append3 =Arrayunique(Split( str1,";"),0)

			If  str1<>"" Then

				For i=0 To Ubound(append3) 

					sendstr=" and assigned to - " + append3(i)

					Call AppendHist(doc,"CR Prepared",sendstr) 

				Next

			End If

		Else

			sendstr=""

			'str1=nam.Common+";"+doc.GetItemValue("BA")(0)+";"+tempdoc.GetItemValue("Lhead")(0)+";"+tempdoc.GetItemValue("Fhead")(0)

			append3 =Arrayunique(Split( str4,";"),0)

			For i=0 To Ubound(append3) 

				sendstr=" and assigned to - " + append3(i)

				Call AppendHist(doc,"CR Prepared",sendstr) 

			Next

			

		End If

		

		If uidoc.FieldGetText("cc")="" Then

			sendstr=""

			str2=doc.GetItemValue("PMn")(0)+";"+doc.GetItemValue("SDM")(0)+";"+doc.GetItemValue("cr_request")(0)+";"+doc.GetItemValue("FinanceApprover")(0)	

			append4= Arrayunique(Split(str2,";"),0)

			If str2<>"" Then

				For i=0 To Ubound(append4) 

					sendstr=" and sent a CC to - " + append4(i)

					Call AppendHist(doc,"CR Prepared",sendstr) 

				Next

			End If

		Else

			sendstr=""

			'str2=nam1.Common+";"+doc.GetItemValue("PMn")(0)+";"+doc.GetItemValue("SDM")(0)+";"+ doc.GetItemValue("cr_request")(0)

			append4= Arrayunique(Split(str5,";"),0)

			For i=0 To Ubound(append4) 

				sendstr=" and sent a CC to - " + append4(i)

				Call AppendHist(doc,"CR Prepared",sendstr) 

			Next

		End If

	'Call uidoc.FieldSetText("SaveOptions","0")

		Msgbox "Your request has been sent for review",64,"Message"

		Call uidoc.Close

	'End If

		

	'Call mailsend(uidoc,uidoc.FieldGetText("SDPM"),uidoc.FieldGetText("cc"),"",mailsub, mailmes,mailremarks,"","","",False)

	Elseif result1 = False Then

		str6=Trim(uidoc.FieldGetText("impact_sy1"))

		Set tempdoc1= view1.GetDocumentByKey(str6,True)

		Call uidoc.FieldSetText("Status","Under Analysis")

		Call uidoc.FieldSetText("cr_prep",session.CommonUserName)

		Call uidoc.FieldSetText("prep_time",Format$(chk1.DateOnly,"dd/mm/yyyy"))

		

		Call uidoc.Save

		

		mailsub="CR No: "+ uidoc.FieldGetText("F3") +" , is Raised."

		mailmes = "CR No: "+ uidoc.FieldGetText("F3") +" "+ " ,has been raised." & _

		Chr(10) & " " & _

		Chr(10) & "Kindly PROVIDE / APPROVE the details in – Functional Impact & Impact Analysis section of the CR Document attached herewith." + ""  & _ 

		Chr(10) & " " & _

		Chr(10) & "Also, Request you to prepare the ''System/Software Requirement Specification'' for the same." & _

		Chr(10) & " " & _

		Chr(10) & "The CR document link has been attached herewith for your reference."

		

		

		mailremarks=uidoc.FieldGetText("ReviewerNote")

		'*****************for BR Attachment Viewing**********

		

		

		Set parentdoc = db1.GetDocumentByUNID _

		( doc.ParentDocumentUNID )

		Set item =parentdoc.GetFirstItem("brs_att")

		

		

		Call doc.CopyItem(item,"brs_att")

		Call ws.EditDocument(False,doc)

		

		Call doc.Save(True,False)

		

		'*****************************************************

		If Not tempdoc1 Is Nothing Then

			For j=0 To Ubound(tempdoc1.FA)

				If str7 ="" Then

					str7=tempdoc1.FA(j)

				Else

					str7 = str7+";"+tempdoc1.FA(j)

				End If

			Next

		End If

		For w=0 To Ubound(doc.BA)

			If str8 ="" Then

				str8=doc.BA(w)

			Else

				str8 = str8+";"+doc.BA(w)

			End If

		Next

		str1=str8+";"+str7

		str2=doc.GetItemValue("PMn")(0)+";"+doc.GetItemValue("SDM")(0)+";"+ doc.GetItemValue("cr_request")(0)+";"+doc.GetItemValue("FinanceApprover")(0)	

		'Msgbox str2

		Call doc.ReplaceItemValue("raise_evt",session.CommonUserName)

		Call doc.ReplaceItemValue("R",Format$(chk1.DateOnly,"dd/mm/yyyy")+" "+chk1.TimeOnly)

		Call doc.ReplaceItemValue("cr_evt_t",str1)

		Call doc.ReplaceItemValue("cr_evt_cc",str2)

		Call mailsend(uidoc,str1,str2,"",mailsub, mailmes,mailremarks,"","","",False)

			'******************for Tms*************************

		

		

		Targetdoc.form = "ImportData"

		Call Targetdoc.ReplaceItemValue("CR_BRnO",doc.GetItemValue("doc_id1")(0))

		Call Targetdoc.ReplaceItemValue("business",doc.GetItemValue("business_1")(0))

		Call Targetdoc.ReplaceItemValue("Projecttitle",doc.GetItemValue("title")(0)) 

		Call Targetdoc.ReplaceItemValue("status",doc.GetItemValue("Status_1")(0)) 

		Call Targetdoc.Save(True,False)

		

		

		'***************************************************

		sendstr=""

		append3 =Arrayunique(Split( str1,";"),0)

		If  str1<>"" Then

			For i=0 To Ubound(append3) 

				sendstr=" and assigned to - " + append3(i)

				Call AppendHist(doc,"CR Prepared",sendstr) 

			Next

		End If

		append4= Arrayunique(Split(str2,";"),0)

		If str2<>"" Then

			For i=0 To Ubound(append4) 

				sendstr=" and sent a CC to - " + append4(i)

				Call AppendHist(doc,"CR Prepared",sendstr) 

			Next

		End If

		

		

		

	'Call mailsend(uidoc,uidoc.FieldGetText("SDPM"),uidoc.FieldGetText("cc"),"",mailsub, mailmes,mailremarks,"","","",False)

	'Call uidoc.FieldSetText("SaveOptions","0")

	'Call uidoc.Close

	'Exit Sub

		

		Call uidoc.FieldSetText("SaveOptions","0")

	'Msgbox "Your request has been sent for review",64,"Message"

		Call uidoc.Close

		Exit Sub

	End If

End If



'Call uidoc.Close





'Call uidoc.Close

%REM

s

Call uidoc.Save



uidoc.AutoReload=False

'Dim sendstr As String

sendstr=""

If uidoc.FieldGetText("T")<>"" Then

	sendstr=" and assigns to - " + uidoc.FieldGetText("T")

End If

If uidoc.FieldGetText("cc")<>"" Then

	sendstr=" and sends a CC to - " + uidoc.FieldGetText("cc")

End If



Call AppendHist(doc,"CR Prepared",sendstr) 

Call uidoc.Close(True)

%END REM

%REM

@Command( [EditDocument]; “1” );

FIELD Status:=“Under Analysis”;

FIELD cr_prep := @Name([CN];@UserName);

FIELD prep_time := @Now;

@If(!@Command([FileSave]);“”;@Success);

@DialogBox(“Reviewer Note”; [AutoHorzFit] : [AutoVertFit] : [NoCancel] ; “Reviewer Note”);

result1:=@Prompt([YesNo];“Option”;“Do you want to attach file with this link?”);

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

@If(result1=1;@Command( [EditInsertFileAttachment]) ;“”);

result:=@Prompt([YesNo];“Option”;“CR will go to SD-PM and requester. Do you want to send this link to more people?”);

FIELD T:=T;

FIELD cc:=cc;

@If(result=1;@DialogBox(“Namelist”;“”; “Please select the names from address book”);“”);

s

@MailSend(SDPM:T;cc;“”; " CR No “+ F3 + " is raised “;””;"A Change Request is posted for your review and updations " + @Char(0) + “Please click on the following link to Review:” + @Char(0);[IncludeDoclink]);

@Prompt([Ok];“Message”;“Your request has been sent for review”);

@PostedCommand([FileSave]);

@PostedCommand([FileCloseWindow])

%END REM

Exit Sub

error1:

Msgbox Error$ &";" & (Cstr(Err)&";"&Cstr(Erl))

Exit Sub	

End Sub

Subject: Invalid universal Id;4091;762

Not matching the UNID to a document in the database raises lsERR_NOTES_BAD_UNID (4091)

I`m pretty sure it happens when You use getDocumentByUnid in the code.

Set parentdoc = db1.GetDocumentByUNID _

( doc.ParentDocumentUNID )

before using this code i suggest you to check if there is parent document for doc

parentdocumentunid method returns “” if there is no parent document universal ID

so check for it:

if doc.isResponse then

Set parentdoc = db1.GetDocumentByUNID _

( doc.ParentDocumentUNID )

else

messagebox “Current Document Has no Parent.”, 16, “err”

exit sub/function

end if

(Put checks and see what happens)