Setting custom field in 7.0.175 c#

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

Setting custom field in 7.0.175 c#

Postby DannyC » Tue Sep 08, 2026 2:59 pm

I have a debtors custom field.
When I create a new debtor I want to default the value. It's a boolean and I'd like it to be unticked i.e. false.

This client is still on 7.0.175 and I am developing code in c#.

I've been trying various syntax for a few hours now and have searched high & low in amongst my old code, the forums, etc and I can't nut out.
Basically on the event debtor.CreateEnd I just want to set the checkbox to false.

That'll force the custom field to be set with a value instead of just saving and the custom field value isn't even there.

I've got code for 7.2.1 and VB.Net code for 7.0.175 but even converting the VB to c# isn't bearing fruit.
User avatar
DannyC
Senpai
Senpai
 
Posts: 748
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 32

Re: Setting custom field in 7.0.175 c#

Postby Mike.Sheen » Tue Sep 08, 2026 3:06 pm

DannyC wrote:I've got code for 7.2.1 and VB.Net code for 7.0.175 but even converting the VB to c# isn't bearing fruit.


What a tease you are!

You won't show us the VB Code you already have - which you know works for 7.0.175 - which just needs to be converted to c#, and instead you're going to make us go on software archeology expedition to work out what the plugin code for a 10 year old version of the software would have looked like.

I'll get the thawing process started on the 7.0.175 code - might take a few weeks, however.
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: 2630
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 825

Re: Setting custom field in 7.0.175 c#

Postby perry » Sat Sep 12, 2026 12:00 am

I think back then the .CustomFieldValues doesn't have the value object in the list if user didn't tick it on the UI. You need to init and add the object to the list.

Code: Select all

'I cant remember if it was 1/0 or true/false for checkbox...
 CustomValue_Set(salesOrderLine.CustomFieldValues, SO.LineCustomFields, "boolFieldName", "true", salesOrderLine.RecID)

'sub
Private Sub CustomValue_Set(CVs As JiwaApplication.CustomFields.CustomFieldValueCollection, _
                                  CFs As JiwaApplication.CustomFields.CustomFieldCollection, _
                                  FieldName As String, value As String, RecID As String)

    Dim cv As JiwaApplication.CustomFields.CustomFieldValue
    Dim cf As JiwaApplication.CustomFields.CustomField

    Dim bFound As Boolean = False

    For Each cv In CVs
        If cv.CustomField.PluginCustomField.Name.Equals(FieldName) Then
            cv.Contents = value
            bFound = True
        End If
    Next

    If Not bFound Then
        For Each cf In CFs
            If cf.PluginCustomField.Name.Equals(FieldName) Then
                cv = New JiwaApplication.CustomFields.CustomFieldValue
                CVs.Add(cv)
                cv.CustomField = cf
                cv.Contents = value
                Exit For
            End If
        Next
    End If

End Sub
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 177
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 16


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 297 guests

cron