Add CommentLine to a PO  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Add CommentLine to a PO

Postby OliverYan » Mon Feb 26, 2018 3:16 pm

Hi,

I have created a plugs to insert a commentline to PO, the key parameter NewKey is now a Object, not a string value. how/what value can I assign value to this object?

Here is my code,

Dim oNewKey=New Object()

If CommentLineText<>"" Then
purchaseorder.Lines.AddCommentLine(CommentLineText,oNewkey,0)
End If

no error raised when I compile this code. but when I run it in PO creation, it crash Jiwa.
Would you please help?

Thanks,
Oliver
OliverYan
Occasional Contributor
Occasional Contributor
 
Posts: 13
Joined: Tue Nov 11, 2014 11:26 pm
Topics Solved: 1

Re: Add CommentLine to a PO  Topic is solved

Postby Mike.Sheen » Wed Feb 28, 2018 10:36 pm

Hi Oliver,

To add a comment to a purchase order, the following code works for me:

Code: Select all
Dim newKey As Object
po.Lines.AddCommentLine("This is a comment", newKey)


I think your problem may be declaring your oNewkey variable as an array of objects.

Code: Select all
Dim oNewKey=New Object()


I've attached a sample plugin which I have tested in 07.00.175.00 which adds a comment when a new purchase order is created.

Plugin Add PO Comment.xml
Sample Plugin
(30.31 KiB) Downloaded 104 times


Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Add CommentLine to a PO

Postby OliverYan » Thu Mar 01, 2018 12:02 am

Thanks Mike,

I did as you suggested, doesn't work.
I changed the code as below.
Code: Select all
purchaseorder.Lines.AddCommentLine(CommentLineText,"",purchaseorder.Lines.Count+1)


it works. weird!
OliverYan
Occasional Contributor
Occasional Contributor
 
Posts: 13
Joined: Tue Nov 11, 2014 11:26 pm
Topics Solved: 1

Re: Add CommentLine to a PO

Postby Mike.Sheen » Thu Mar 01, 2018 5:07 pm

OliverYan wrote:I did as you suggested, doesn't work.


I did actually test the code by importing the plugin I supplied and created a new Purchase Order and sure enough, a new note appeared on the notes tab - so it did work for me.

When you say "doesn't work" - do you have any error message or anything? Does it still crash Jiwa as you said initially, or is the behaviour any different?
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 25 guests