Stock Transfer. Reading the warehouse, setting the reason  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Stock Transfer. Reading the warehouse, setting the reason

Postby DannyC » Mon Jul 27, 2015 6:18 pm

Been fiddling with this one for a while now & have reached the point of posting a topic.
When a Stock Transfer is created, I want to read the warehouse it is created in and change the stock transfer reason.

The general point of the plugin is to set the reason (and the subsequent write off/on accounts) based on the warehouse the transfer is in.

Using the BusinessLogicPlugin class I cannot find any property of the Stock Transfer which provides the logical warehouse name or LogicalID. Not only that, but the StockTransferReason property is read only anyway. I figure I must be barking up the wrong tree completely.

Can you assist?

Cheers
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Stock Transfer. Reading the warehouse, setting the reaso  Topic is solved

Postby Scott.Pearce » Tue Jul 28, 2015 8:52 am

DannyC wrote:Using the BusinessLogicPlugin class I cannot find any property of the Stock Transfer which provides the logical warehouse name or LogicalID.


Code: Select all
MyStockTransferObject.LogicalWarehouseResidingIn.IN_LogicalID


or

Code: Select all
MyStockTransferObject.LogicalWarehouseResidingIn.Description


DannyC wrote:Not only that, but the StockTransferReason property is read only anyway.

It's an entity. To change it, you would "read" the stock transfer reason you want, thus:

Code: Select all
MyStockTransferObject.StockTransferReason.ReadRecord(RecIDtoRead)


or:

Code: Select all
MyStockTransferObject.StockTransferReason.ReadRecordByName("Damaged")


or:

Code: Select all
MyStockTransferObject.StockTransferReason.ReadDefault


You will find that this use of entities, which must be "read" instead of "set", is becoming increasingly common.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: Stock Transfer. Reading the warehouse, setting the reaso

Postby DannyC » Tue Jul 28, 2015 9:03 am

That's awesome Scott.
Plugin tested & working nicely.
My flaw was not typing a dot after the LogicalWarehouseResidingIn to see if there was anything else after it. And same for StockTransferReason.

Cheers
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests