Programmatically opening Stock Transfer in editable mode  Topic is solved

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

Programmatically opening Stock Transfer in editable mode

Postby DamonR » Mon Sep 15, 2025 4:47 pm

Hi guys,

I've been frustratingly trying to prgrammatically open a new stock transer tab in a Jiwa 7.2.1 VB.NET plugin.

From Sales Order form, I add a ribbon button and try to open a new Stock Transfer tab. The ST UI opens but is non-interactive and shows the red “Activated” badge.

Diagnostic shows:
Form type: JiwaFinancials.Jiwa.JiwaStockTransferUI.MainForm (assembly JiwaStockTransferUI.dll)
Public zero-param method: NewRecord()
Ribbon tool exists: key ID_RecordNew (“New”)

Calling NewRecord() and/or clicking ID_RecordNew via reflection doesn’t change the state.
Direct instantiation via Activator.CreateInstance + Show() behaves the same.
Forcing flags (ReadOnly/Activated/Locked) and setting Status=1 (Open) on the form/guessed BO has no effect.
The MDI parent doesn’t expose a usable “New” tool for this form.

What is the supported API to open the Stock Transfer UI in New (editable) mode from another form/plugin?
Is there an application/forms manager I should call (e.g. JiwaApplication.FormsManager/OpenForm/CreateForm) rather than Activator.CreateInstance?
If so, what method name/signature should we use and what string/type identifier should we pass for Stock Transfer?
Does MainForm require a business object to be created/bound before calling NewRecord()?
If yes, what is the correct BO type and factory to use, and how do I attach it to MainForm (method/property name)?
After binding, is MainForm.NewRecord() the correct entry point, or is there another public method (e.g. RecordNew, CreateNew) I should call?
The badge shows Activated; our DB mapping is 0 = Activated, 1 = Open.
Which property/enum on the form/BO does the UI bind to for this status?
Where can I access that object from MainForm (property name), and is there a supported way to set it to Open programmatically?
Are there any security/permission checks or initialisation steps (e.g., session/context services) that prevent programmatic “New” unless opened via the official manager?

Could you provide a minimal VB.NET snippet (Jiwa 7.2.1-compatible) that opens JiwaStockTransferUI.MainForm as an MDI child from another form and ensures it’s in New state and editable?

Thanks in advance.
DamonR
I'm new here
I'm new here
 
Posts: 6
Joined: Mon Jul 15, 2024 4:08 pm

Re: Programmatically opening Stock Transfer in editable mode  Topic is solved

Postby Mike.Sheen » Mon Sep 15, 2025 5:34 pm

The recommended way to create an instance of a form is to use the FormFactory.

Attached is a plugin (in VB.NET, for Jiwa 7.2.1) which adds a tool to the sales order ribbon, and when pressed it opens a stock transfer form, creates a new transfer and adds all the lines on the sales order which have backorders and sets the transfer quantity to be the backorder quantity.
Plugin Open Stock Transfer Form.xml
(13.58 KiB) Downloaded 480 times


The significant portion is:
Code: Select all
Dim stockTransferForm As JiwaFinancials.Jiwa.JiwaStockTransferUI.MainForm = salesOrderForm.Manager.FormFactory.CreateForm(Of JiwaFinancials.Jiwa.JiwaStockTransferUI.MainForm)()
' Set stockTransferForm.DrillDownID before calling Start() if you want to load an existing transfer, Or you can call stockTransferForm.StockTransfer.Read(RecID) after Start()   
stockTransferForm.Start()         
stockTransferForm.StockTransfer.CreateNew()   
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: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Programmatically opening Stock Transfer in editable mode

Postby SBarnes » Mon Sep 15, 2025 5:46 pm

Although in c# the attached plugin should give you enough to go by, basically you need to use the manager on the sales form to create the form using is form factory and then start the form to get it to dock as a tab and then call new record.
Attachments
Plugin StockTransfer.xml
(36.41 KiB) Downloaded 459 times
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Programmatically opening Stock Transfer in editable mode

Postby DamonR » Mon Sep 15, 2025 5:47 pm

Wont be forgetting that in a hurry. Thanks Mike!
DamonR
I'm new here
I'm new here
 
Posts: 6
Joined: Mon Jul 15, 2024 4:08 pm


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 2 guests