Page 1 of 1

Duplicate Integration

PostPosted: Thu Sep 04, 2025 6:49 pm
by SBarnes
I have customer who we built an integration for to retrieve orders and insert them into Jiwa, to marry to the external ids for debtor and inventory in the other system there are custom fields that hold the the other systems ids that are used for the lookup.

Now the customer wants to run a second copy of the same integration that points to a different end point(system/database) and would have different id's for the customers and products.

If I duplicate the plugin I can solve the system settings with code like the below but is there a way to do a similar thing with custom fields on the debtor, invetory and sales order, i.e. take into account the plulgin name in getting or setting the values so in the end the code can be the same and just fix up the descriptions on the custom fields so the user will know the difference when setting things up.

Code: Select all
      JiwaFinancials.Jiwa.JiwaApplication.Manager JiwaApplicationManager = Plugin.Manager;
      System.Reflection.AssemblyName aName = new System.Reflection.AssemblyName(System.Reflection.Assembly.GetExecutingAssembly().GetName().FullName);

      SettingsVault.ClientID = JiwaApplicationManager.Database.ReadSysData(aName.Name, "IClientID", "").ToString();
      SettingsVault.ClientSecret = JiwaApplicationManager.Database.ReadSysData(aName.Name, "IClientSecret", "").ToString();

Re: Duplicate Integration

PostPosted: Thu Sep 04, 2025 7:28 pm
by Mike.Sheen
Why so complicated?

The following could replace your code above - it should do the same thing.

Code: Select all
SettingsVault.ClientID = Plugin.Manager.Database.ReadSysData(Plugin.Name, "IClientID", "").ToString();
SettingsVault.ClientSecret = Plugin.Manager.Database.ReadSysData(Plugin.Name, "IClientSecret", "").ToString();


As for Custom fields, I thought the JiwaApplication.CustomFields.CustomFieldValueCollection class had helper methods to get custom fields including field name AND plugin name?

Re: Duplicate Integration

PostPosted: Thu Sep 04, 2025 7:32 pm
by SBarnes
Thanks, I'll check

Re: Duplicate Integration  Topic is solved

PostPosted: Thu Sep 04, 2025 7:46 pm
by SBarnes
Yeah two versions


Code: Select all
        public CustomFieldValue ItemFromSettingName(string SettingName)
     
        public CustomFieldValue ItemFromSettingName(string SettingName, string PluginName)