Save a pdf against a sales order  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Save a pdf against a sales order

Postby SBarnes » Thu Feb 06, 2020 12:37 pm

How can I save a pdf that is in a memory stream (i.e. I am going to grab it from a URL) as a document attached to a sales order?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Save a pdf against a sales order

Postby Mike.Sheen » Thu Feb 06, 2020 6:47 pm

All memory streams can be converted to a byte array easy enough, then it's just a matter of creating a new document and setting the FileBinary property to be that byte array and adding it to the documents collection of the sales order.

This seems to simple... I must be missing something...
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: Save a pdf against a sales order

Postby SBarnes » Thu Feb 06, 2020 6:50 pm

It was more the physical file name, is that used when Jiwa reconstitutes the file?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Save a pdf against a sales order  Topic is solved

Postby Mike.Sheen » Thu Feb 06, 2020 7:11 pm

SBarnes wrote:It was more the physical file name, is that used when Jiwa reconstitutes the file?


Ok, yep - we use that physical file name property to construct a path + physical file name when the user right clicks on the document and chooses "Open" or "Save" or whatever. We just need a file name to default to in order to make the users life easier - but you can make it anything you want - even just "document.pdf" will do.
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: Save a pdf against a sales order

Postby SBarnes » Tue Feb 11, 2020 3:03 pm

Is there a quick way to get the default document type for a sales order?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Save a pdf against a sales order

Postby Scott.Pearce » Tue Feb 11, 2020 3:12 pm

Code: Select all
salesOrder.Documents.DocumentTypes.GetDefaultDocumentType();
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221


Return to Technical and or Programming

Who is online

Users browsing this forum: Google [Bot] and 3 guests

cron