TransformPDFFields option not working in CreateEnvelopeFromTemplatesAndForms using SOAP API - vb.net

I am trying to create envelop using CreateEnvelopeFromTemplatesAndForms to make the pdf form fields editable. I am gettting unspecified_error. I have also tried removing the document from composite template and adding the document in the inline template envelop. In this case it creates and sends the envelop but does not make the fields editable. See my code below
'compositeTemplate
Dim envInfo As New EnvelopeInformation
With envInfo
.AccountId = c.AccountID
.Subject = subject
.EmailBlurb = emailBlurb
End With
Dim template As New CompositeTemplate
'recipients
Dim recipients As New List(Of Recipient)
For iRecip As Integer = 1 To packet.Recipients.Count
Dim recipient As New Recipient
Dim customfields As New List(Of String)
With packet.Recipients(iRecip - 1)
recipient.Email = .Email
recipient.SignerName = .Name
recipient.UserName = .Name
recipient.ID = .ID
recipient.RoutingOrder = .RoutingOrder
recipient.RoutingOrderSpecified = True
recipient.RequireIDLookup = .RequireIDLookup
recipient.RequireIDLookupSpecified = True
recipient.AccessCode = .AccessCode
recipient.AddAccessCodeToEmail = False
recipient.AddAccessCodeToEmailSpecified = True
recipient.DefaultRecipient = .DefaultRecipient
recipient.DefaultRecipientSpecified = .IsDefaultRecipientSpecified
If (Not String.IsNullOrEmpty(.CaptiveInfoClientUserId)) Then
recipient.CaptiveInfo = New RecipientCaptiveInfo()
recipient.CaptiveInfo.ClientUserId = .CaptiveInfoClientUserId
End If
customfields.Add(String.Format("SignerRole={0}", .Role))
End With
'add customfields list to recipient customfields
recipient.CustomFields = customfields.ToArray
recipients.Add(recipient)
Next
Dim inlineTemplate As New InlineTemplate
inlineTemplate.Sequence = 1
inlineTemplate.Envelope = New Envelope
inlineTemplate.Envelope.AccountId = c.AccountID
With inlineTemplate.Envelope
.Notification = New APIService.Notification
Dim exp As New APIService.Expirations
With exp
.ExpireEnabled = _envelopeExpirationEnabled
If _envelopeExpirationEnabled Then
.ExpireAfter = _envelopeExpirationDays
If _envelopeExpirationWarningEnabled Then
.ExpireWarn = _envelopeExpirationWarningDaysLeft
End If
End If
End With
.Notification.Expirations = exp
End With
Dim tabs As New List(Of Tab)
'add documents
Dim documents As New List(Of Document)
Dim matchBoxes As New List(Of MatchBox)
For iDoc As Integer = 1 To packet.Forms.Count
Dim theForm As Objects.Form = packet.Forms(iDoc - 1)
theForm.ID = iDoc
Dim document As New Document
document.Name = theForm.FilePath
document.PDFBytes = theForm.FileBytes
document.ID = theForm.ID
document.TransformPdfFields = True
'add tabs - this will be based on metadata defined in the database for the attached forms
For Each oTab As Objects.Tab In theForm.Tabs
Dim tab As New Tab
If Not String.IsNullOrEmpty(oTab.AnchorText) AndAlso oTab.TabType <> TabTypeCode.Custom Then
Dim aTab As New AnchorTab
aTab.AnchorTabString = oTab.AnchorText
tab.AnchorTabItem = aTab
ElseIf oTab.TabType = TabTypeCode.Custom Then
tab.TabLabel = oTab.AnchorText
End If
With tab
.DocumentID = document.ID
.RecipientID = oTab.Recipient.ID
.Type = oTab.TabType
.PageNumber = oTab.PageNumber
.XPosition = oTab.XPosition
.YPosition = oTab.YPosition
If .Type = TabTypeCode.InitialHere Then
.ScaleValueSpecified = True
.ScaleValue = 0.53
End If
End With
tabs.Add(tab)
Next
documents.Add(document)
Next
inlineTemplate.Envelope.Recipients = recipients.ToArray
inlineTemplate.Envelope.Tabs = tabs.ToArray
template.InlineTemplates = New InlineTemplate() {inlineTemplate}
template.Document = New Document
template.Document.ID = 1
template.Document.Name = "TemplateDoc"
template.Document.PDFBytes = documents(0).PDFBytes
template.Document.TransformPdfFields = True
template.Document.FileExtension = "pdf"
Dim _apiProxy As APIServiceSoap = CreateApiProxy(c)
Dim envStatus As EnvelopeStatus = _apiProxy.CreateEnvelopeFromTemplatesAndForms(envInfo, New CompositeTemplate() {template}, True)
Any assistance would be greatly appreciated.
Thanks,
Pulak

The best way to debug such issues (which are sometimes bugs on the DocuSign server side) is to inspect your raw (XML based) SOAP request that you are sending over the wire. If I were you I would include it here in your question as it's much easier to diagnose when we can see the request as opposed to the code that creates the request.
With that said, are setting the tab's Locked property to false so that it's editable? You'll also need to set CustomTabLockedSpecified property to true for this to take affect.
Basically, in your tab definition code try something like this:
With tab
.DocumentID = document.ID
.RecipientID = oTab.Recipient.ID
.Type = oTab.TabType
...
.CustomTabLockedSpecified = True
.CustomTabLocked = False

Related

WSDL creating and padding array into Object

I'm trying to get away from stringbuilder SOAP requests and converting to using a WSDL document. Really trying to learn :)
I'm using a WSDL located at: production wsdl
I'm making a rate request for freight. I have 2 commodity loads as follow
commoditiy #1
class 60
weight 560
description Books
commoditiy #2
class 65
weight 230
description Used Books
I'm usein the FullCommoditiesType in the rate request itself.
The commodities are passed into an object termed "Item" which is part of the actual raterequest.
I'm having issues with assignment of the commodities to and array and passing it into the myrequest.item
I see in the FullCommoditiesType the "commodity" as FullCommodityType but can't get my head wrapped around how to construct the commodities into and array and pass it into the FullCommoditiesType.
I've been stuck on this for a loooong time (hours and hours) and would appreciate any help at all. I've googled lots of how to consume a WSDL and watch video's etc.
Thanks in advance :)
-dan
Right now I have
Dim myAuthorize As New wsdl_estes.AuthenticationType
Dim myrequest As New wsdl_estes.rateRequest()
Dim EstesRates As ratingPortTypeClient = New ratingPortTypeClient
Dim pickup As New wsdl_estes.PointType
Dim delivery As New wsdl_estes.PointType
With myAuthorize
.user = ("myuser")
.password = ("myPwd")
End With
With myrequest
.account = ("xxxxxx")
.payor = ("S")
.terms = ("P")
End With
With pickup
.city = ("Knoxville")
.stateProvince = ("TN")
.postalCode = ("37918")
.countryCode = ("USA")
End With
With delivery
.city = ("Knoxville")
.stateProvince = ("TN")
.postalCode = ("37918")
.countryCode = ("USA")
End With
myrequest.originPoint = pickup
myrequest.destinationPoint = delivery
Dim loaddata As New wsdl_estes.FullCommoditiesType()
Dim myload1 As New FullCommodityType
With myload1
.class = (60)
.weight = ("350")
.description = ("Used Books-Magazines")
.pieces = ("1")
.pieceType = PackagingType.SK
End With
myrequest.Item = myload1
Dim MyResponse As rateQuote = Nothing
MyResponse = EstesRates.getQuote(myAuthorize, myrequest)
End Sub
And the cure was
Dim loaddata As New wsdl_estes.FullCommoditiesType
Dim comList As New List(Of wsdl_estes.FullCommodityType)
Dim com As wsdl_estes.FullCommodityType
'1St commodity
com = New wsdl_estes.FullCommodityType()
com.class = 60
com.description = ("Used Books")
com.weight = ("1680")
com.pieces = ("1")
com.pieceType = PackagingType.SK
com.dimensions = New wsdl_estes.DimensionsType()
com.dimensions.length = ("42")
com.dimensions.width = ("42")
com.dimensions.height = ("36")
comList.Add(com)
loaddata.commodity = comList.ToArray()
myrequest.Item = loaddata
My thanks to Jim who provided the answer

Insert into table without LOOP in VB.NET

I have
For Each itemSN As SellingDetailSNCustomer In item.listSN
Dim newItem As New TR_Selling_Customer_Product_SN
newItem.FK_Selling_Detail_Customer_ID = oNew.PK_Selling_Customer_Detail_ID
newItem.SN = itemSN.SNProduct
newItem.CreatedDate = Now.ToString("yyyy-MM-dd")
newItem.CreatedBy = "system"
newItem.LastUpdateDate = Now.ToString("yyyy-MM-dd")
newItem.LastUpdateBy = "system"
newItem.Active = True
objdb.Entry(newItem).State = Entity.EntityState.Added
Dim obUpdateBookedSN As MS_Product_Serial_Number = (From x In objdb.Product_Serial_Number Where x.FK_Product_ID = item.FK_Product_ID And x.Serial_Number = itemSN.SNProduct Select x).FirstOrDefault
If obUpdateBookedSN IsNot Nothing Then
obUpdateBookedSN.Booked_Serial_Number = True
obUpdateBookedSN.LastUpdateDate = Now.ToString("yyyy-MM-dd")
obUpdateBookedSN.LastUpdateBy = "system"
objdb.Entry(obUpdateBookedSN).State = Entity.EntityState.Modified
End If
Next
objdb.SaveChanges()
When I have more than thousand serial number, this looping become very slow processing time.
I want to changes this code without looping.
How do I figure that out?

Datagridview doesnt show data in rows

I am currently working on project in which i have to display IP Configuration to user in VB.Net Application.
I am using DataGridView to display IP Config to user.
But problem is Datagridview doesnt display anything in its row at all.
Image for proof
Here is the code
Public Sub MT_Validate_Msg(ByRef lbData() As Byte)
Dim lsAddr(3) As String
Dim lsMAC(5) As String
Dim lstConfig As TCP_SER_Config
If lbData.Length >= 256 Then
'Check Header Footer and Response Size
If lbData(0) = Asc("$") And lbData(1) = Asc("#") _
And lbData(254) = Asc("<") And lbData(255) = Asc(">") _
And lbData(2) = UDP_RESPONSE_SIZE And lbData(3) = 0 Then
gnDevice_Search_Count += 1
'MsgBox("Response Received")
lsAddr(0) = lbData(7).ToString
lsAddr(1) = lbData(9).ToString
lsAddr(2) = lbData(11).ToString
lsAddr(3) = lbData(13).ToString
lstConfig.IP = String.Join(".", lsAddr)
lsAddr(0) = lbData(15).ToString
lsAddr(1) = lbData(17).ToString
lsAddr(2) = lbData(19).ToString
lsAddr(3) = lbData(21).ToString
lstConfig.Subnet = String.Join(".", lsAddr)
lsAddr(0) = lbData(23).ToString
lsAddr(1) = lbData(25).ToString
lsAddr(2) = lbData(27).ToString
lsAddr(3) = lbData(29).ToString
lstConfig.Gateway = String.Join(".", lsAddr)
lstConfig.Alive_Time = lbData(31)
lsMAC(0) = Hex(lbData(33)).ToString
lsMAC(1) = Hex(lbData(34)).ToString
lsMAC(2) = Hex(lbData(35)).ToString
lsMAC(3) = Hex(lbData(36)).ToString
lsMAC(4) = Hex(lbData(37)).ToString
lsMAC(5) = Hex(lbData(38)).ToString
lstConfig.MAC = String.Join("-", lsMAC)
MT_FillGrid(lstConfig)
End If
End If
End Sub
Public Sub MT_FillGrid(ByRef lstTCPConfig As TCP_SER_Config)
Dim row As String() = New String() {gnDevice_Search_Count.ToString, lstTCPConfig.IP, lstTCPConfig.Subnet, _
lstTCPConfig.Gateway, lstTCPConfig.Alive_Time.ToString, lstTCPConfig.MAC}
GridDev_List.Rows.Add(row)
row = New String() {"1", "192.168.0.100", "255.255.255.0", "255.255.255.255", "60", "22-0B-3C-2D-00-01"}
GridDev_List.Rows.Add(row)
End Sub
Expecting a result like this, Where i am going wrong in code ?

SAP B1 - Option Button- 'Unable to cast object System.String to type SAPbouiCOM.Item' Error

I am writing a vb.net code in Visual Studio for an add on in SAP B1. Right now, I want to choose an option button and according to what the user chose, I want to take this value and send it to another function in another class. This action I want to make it right after the user press the OK button, so I am trying to do this in an event.
The code that I wrote for creating the options buttons:
Dim optBtn As SAPbouiCOM.OptionBtn
'Dim oFrm As SAPbouiCOM.Form
Dim oUserdatasource As SAPbouiCOM.UserDataSource
oUserdatasource = oform2.DataSources.UserDataSources.Add("BD_resDS", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1)
'Option 1
oItem = oform2.Items.Add("BD_rbRes", SAPbouiCOM.BoFormItemTypes.it_OPTION_BUTTON)
oItem.Left = 155
oItem.Top = 10
oItem.Height = 16
oItem.Width = 55
optBtn = oItem.Specific
optBtn.Caption = "Cheque"
optBtn.DataBind.SetBound(True, , "BD_resDS")
'Option 2
oItem = oform2.Items.Add("BD_rbPost", SAPbouiCOM.BoFormItemTypes.it_OPTION_BUTTON)
oItem.Left = 220
oItem.Top = 10
oItem.Height = 16
oItem.Width = 55
optBtn = oItem.Specific
optBtn.Caption = "Cash"
oItem.Visible = True
optBtn = oItem.Specific
optBtn.GroupWith("BD_rbRes")
optBtn.DataBind.SetBound(True, , "BD_resDS")
'Option 3
oItem = oform2.Items.Add("BD_rbPost2", SAPbouiCOM.BoFormItemTypes.it_OPTION_BUTTON)
oItem.Left = 280
oItem.Top = 10
oItem.Height = 16
oItem.Width = 75
optBtn = oItem.Specific
optBtn.Caption = "Credit Card"
oItem.Visible = True
optBtn = oItem.Specific
optBtn.GroupWith("BD_rbPost")
The code that I wrote in the event is this :
Public Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Try
Dim fInv As SAPbouiCOM.Form
Dim omethod As SAPbouiCOM.Item
Dim opaymeth As SAPbouiCOM.OptionBtn
Dim paymeth As String
'If pVal.ItemUID = "1" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.BeforeAction = True And pVal.ActionSuccess = False And pVal.FormUID = "60006" Then
'End If
'Events of the Blanket Agreement form
If (FormUID = "Choose") Then
If (pVal.BeforeAction = False) Then
' Click on Add Row
If (pVal.ItemUID = "1") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Then
fInv = SBO_Application.Forms.Item(FormUID)
omethod = fInv.DataSources.UserDataSources.Item("BD_resDS").ValueEx
opaymeth = omethod.Specific
paymeth = opaymeth.Value.ToString()
SBO_Application.MessageBox(paymeth)
If paymeth <> "" And paymeth <> Nothing Then
Dim paym As New payment(SBO_Application, oCompany)
paym.pay(paymeth)
End If
End If
End If
End If
Catch ex As Exception
'SBO_Application.MessageBox(er.Message)
SBO_Application.MessageBox(ex.Message)
End Try
End Sub
Now, the error that I got in SAP B1 is:
Unable to cast object 'System.String' to type 'SAPbouiCOM.Item'
You have declared
Dim omethod As SAPbouiCOM.Item
and assigning it to the string value
omethod = fInv.DataSources.UserDataSources.Item("BD_resDS").ValueEx
Declare string variable and assign value to it like
Dim tmpval as string =""
tmpval = fInv.DataSources.UserDataSources.Item("BD_resDS").ValueEx
try this
omethod = fInv.DataSources.UserDataSources.Item("BD_resDS").ValueEx
.ValueEx seems to return a String, so I guess you just need to remove it
omethod = fInv.DataSources.UserDataSources.Item("BD_resDS")
Another fine example why you should always turn Option Strict ON ;)

Datagrid on VB.net auto complete the other column?

I have a datagrid and I have imported it to my project under vb.net language, and the database is MS access...
any way in this datagrid one table call
"Employees"
ID - Name - Nationality - Job title
and what I want is when I write the ID number of the Employee, all the other details automatically comes upon to his ID number.
I found near answer I made it by my self ...
But it shown the result in combobox not text box :'(
Dim dgvc1 As New DataGridViewComboBoxColumn()
Dim index1 As Integer = DataGridView1.Columns.IndexOf(DataGridView1.Columns("code"))
Dim index11 As Integer = DataGridView1.Columns.IndexOf(DataGridView1.Columns("nu"))
Dim index111 As Integer = DataGridView1.Columns.IndexOf(DataGridView1.Columns("aaa"))
Dim dgvc11 As New DataGridViewComboBoxColumn()
dgvc1.Name = "Code Meaning"
dgvc1.DataPropertyName = "nu"
dgvc1.ValueMember = "nu"
dgvc1.DisplayMember = "code"
dgvc1.DataSource = CodesTableAdapter.GetData()
dgvc1.SortMode = DataGridViewColumnSortMode.Automatic
If DataGridView1.Columns.Contains(dgvc1) = False Then
DataGridView1.Columns.Insert(index1, dgvc1)
Else
End If
dgvc1.ReadOnly = True
dgvc1.Width = 250
dgvc11.Name = "meaning total"
dgvc11.DataPropertyName = "nu"
dgvc11.ValueMember = "nu"
dgvc11.DisplayMember = "aaa"
dgvc11.DataSource = CodesTableAdapter.GetData()
dgvc11.SortMode = DataGridViewColumnSortMode.Automatic
If DataGridView1.Columns.Contains(dgvc11) = False Then
DataGridView1.Columns.Insert(index111, dgvc11)
Else
End If
dgvc11.ReadOnly = True
dgvc11.Width = 250
dgvc11.DefaultCellStyle.BackColor = Color.White
dgvc11.DefaultCellStyle.ForeColor = Color.Black