How to get custom fields and their values from a plugin  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

How to get custom fields and their values from a plugin

Postby jak » Tue Jun 20, 2017 7:32 pm

Hi,

I have created a plugin in jiwa previously, now i'm creating a new plugin in jiwa.
In this Plugin i want to export the fields and their data of previous plugin. Can you please let me know how can i get the fields and their values of a plugin using plugin RecID?

Also I want to insert data in those fields as well, can you please let me know this as well?

Thank you in advance
jak
Occasional Contributor
Occasional Contributor
 
Posts: 22
Joined: Mon Oct 10, 2016 10:00 pm
Topics Solved: 0

Re: How to get custom fields and their values from a plugin

Postby Scott.Pearce » Wed Jun 21, 2017 8:49 am

On the "Custom Fields" tab of the original plugin, use the "Move" button next to the custom field definition to move the fields and their values to the new plugin.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 743
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: How to get custom fields and their values from a plugin

Postby jak » Thu Jun 22, 2017 4:04 pm

Hi Scott,

i'm working on new plugin to get data from previously created plugin custom fields, can you please tell me the code which i can add in my developing plugin to get data of custom fields of previously created plugin?

I try to get fields of Jiwa Business Logic classes
JiwaApplication.CustomFields.CustomFieldValue

and

JiwaApplication.Plugin.Plugin

but wasn't get any success as yet, I want to get custom fields of a plugin and data of that fields by using code in newly created plugin?
Can you please help me with it.

Thank you in advance
jak
Occasional Contributor
Occasional Contributor
 
Posts: 22
Joined: Mon Oct 10, 2016 10:00 pm
Topics Solved: 0

Re: How to get custom fields and their values from a plugin

Postby Mike.Sheen » Thu Jun 22, 2017 5:11 pm

Try this:

C#:
Code: Select all
var customFieldValue = debtor.CustomFieldValues.get_ItemFromSettingName("CustomFieldName", "PluginName");
System.Diagnostics.Debug.WriteLine(customFieldValue.Contents); // examine value
customFieldValue.Contents = "x"; // set value


VB:
Code: Select all
Dim customFieldValue as JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomFieldValue = debtor.CustomFieldValues.ItemFromSettingName("CustomFieldName", "PluginName")
System.Diagnostics.Debug.WriteLine(customFieldValue.Contents) ' examine value
customFieldValue.Contents = "x" ' set value


replace debtor with the object instance you're using.

The ItemFromSettingName method is overloaded - so you can either provide both the CustomFieldName and PluginName as shown above, or just the CustomFieldName if you're sure no other plugin will have a custom field of the same 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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: How to get custom fields and their values from a plugin

Postby jak » Thu Jun 22, 2017 6:16 pm

Hi!

Thanks for your reply.
I have try this
Code: Select all
var customFieldValue = jobtask.CustomFieldValues.get_ItemFromSettingName("Debtor No", "Debtor Plugin");


but it says

Code: Select all
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 133:            */
Line 134:
Line 135:            var customFieldValue = jobtask.CustomFieldValues.get_ItemFromSettingName("Debtor No", "Debtor Plugin");



can you please help me with this.

Thank you in advance
jak
Occasional Contributor
Occasional Contributor
 
Posts: 22
Joined: Mon Oct 10, 2016 10:00 pm
Topics Solved: 0

Re: How to get custom fields and their values from a plugin

Postby Mike.Sheen » Thu Jun 22, 2017 8:11 pm

jak wrote:I have try this
Code: Select all
var customFieldValue = jobtask.CustomFieldValues.get_ItemFromSettingName("Debtor No", "Debtor Plugin");


Do you have a plugin named "Debtor Plugin" and does that plugin have a custom field with a name of "Debtor No" ?
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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: How to get custom fields and their values from a plugin

Postby jak » Thu Jun 22, 2017 8:17 pm

yes, I have created that plugin before.
jak
Occasional Contributor
Occasional Contributor
 
Posts: 22
Joined: Mon Oct 10, 2016 10:00 pm
Topics Solved: 0

Re: How to get custom fields and their values from a plugin  Topic is solved

Postby Mike.Sheen » Thu Jun 22, 2017 10:00 pm

I created a plugin named "Debtor Plugin1" and added a custom field "Debtor No" - then I added some code to write to the debug output the value of the custom field whenever a debtor is read - and I didn't get the error, and I saw the output in my debug console.

I've attached the plugin (for version 7.00.175.00) - try that out and see if you have any problems with that.

Mike
Attachments
Plugin Debtor Plugin1.xml
Sample Plugin
(34.91 KiB) Downloaded 139 times
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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 10 guests