Fetch inventory category custom value  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Fetch inventory category custom value

Postby pricerc » Tue Sep 29, 2020 10:34 am

What's the quick-and-easy way to get the custom field value for an inventory category?

I'm in an SO_Line "Property Changed" event, and I want to do a calculation based on an "ExpiryDays" integer value attached to IN_Category1.

I have a SalesOrderLine object, and can get my inventory object.

At this point, I'm having a senior moment. Or it could be that I need lunch.

Either way, I'm stuck on then getting the category custom field value.

Help !?
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20

Re: Fetch inventory category custom value  Topic is solved

Postby Mike.Sheen » Tue Sep 29, 2020 12:27 pm

There is a static (shared in VB) method of the JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomFieldValueCollection class called ReadCustomFieldValue.

You can use that to get the contents of any custom field.

It's overloaded, so there are three signatures:

Code: Select all
Public Shared Function ReadCustomFieldValue(Manager As JiwaApplication.Manager, ValuesTableName As String, ValuesFKIDColumnName As String, ValuesSettingIDColumnName As String, IDColumnName As String, TableName As String, ID As String, SettingName As String) As String

And
Code: Select all
Public Shared Function ReadCustomFieldValue(Manager As JiwaApplication.Manager, CustomFieldModuleName As String, ID As String, SettingName As String) As String

And
Code: Select all
Public Shared Function ReadCustomFieldValue(Manager As JiwaApplication.Manager, ValuesTableName As String, KeyField As String, ID As String, SettingName As String) As String


Here's an example pulled from a working plugin to read a debtor custom field value:

Code: Select all
string caseRatePart = JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomFieldValueCollection.ReadCustomFieldValue(salesOrder.Manager, "Debtor Maintenance", salesOrder.Debtor.DebtorID, "CaseRatePart");


It's using the signature of the 2nd method to get a debtor custom field value (the one I prefer to use). The 2nd parameter is the CustomFieldModule name, which comes from the SY_PluginCustomSettingModules table - in your case that would be "Inventory Category 1". The 3rd parameter is the debtor ID - you want that to be the ID of the IN_Category1 associated with the sales order line item. The 4th param is the custom field name.
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: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: Fetch inventory category custom value

Postby pricerc » Tue Sep 29, 2020 1:18 pm

Thanks Mike, that'll go nicely into a helper function.
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 3 guests