Get form and business logic from CustomFieldValue  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Get form and business logic from CustomFieldValue

Postby DannyC » Fri Dec 24, 2021 12:47 pm

Merry Christmas people!!

From
Code: Select all
JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomFieldValue CustomFieldValue

how can I get the parent form and also the business logic object?

My scenario is that when a sales order custom field changes I want to wipe all the freight charges.
Code: Select all
public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
{
   if (JiwaForm is JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm)
   {
      JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm soForm = (JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm)JiwaForm;
      soForm.SalesOrder.CustomFieldValues.Changed += Attkey_CheckFreight;
   }
}
   
public void Attkey_CheckFreight(JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomFieldValue CustomFieldValue, System.ComponentModel.PropertyChangedEventArgs e)
{
   if (CustomFieldValue.CustomField.PluginCustomField.Name == "FreightType" && CustomFieldValue.Contents == "2")
   {
      //wipe the freight
   }
      
}


I've tried various properties in CustomFieldValue but I haven't found anything which gives me the sales order I'm editing. I'm sure there something I'm missing.
User avatar
DannyC
Senpai
Senpai
 
Posts: 638
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: Get form and business logic from CustomFieldValue  Topic is solved

Postby SBarnes » Fri Dec 24, 2021 1:09 pm

The field has a CustomFieldValueCollection, this then has a CustomFieldCollection this then has a BusinessLogic and this then has a client which is the form.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1621
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 176

Re: Get form and business logic from CustomFieldValue

Postby DannyC » Fri Dec 24, 2021 2:05 pm

That's done it.

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

Re: Get form and business logic from CustomFieldValue

Postby SBarnes » Fri Dec 24, 2021 4:04 pm

I simply followed the Just Decompile bouncing ball, for future reference a lot of the collection objects hold a reference to the collection they are in and a lot of the collections hold a reference to the object that contains them.

Jiwa may correct me and say they all do but I can't say that for certain.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1621
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 176


Return to Technical and or Programming

Who is online

Users browsing this forum: Google [Bot] and 8 guests