Class: LockstepSdk::CustomFieldSyncModel
- Inherits:
-
Object
- Object
- LockstepSdk::CustomFieldSyncModel
- Defined in:
- lib/lockstep_sdk/models/custom_field_sync_model.rb
Overview
The CustomFieldSyncModel represents information coming into Lockstep from an external financial system or other enterprise resource planning system. [Custom Fields](developer.lockstep.io/docs/custom-fields#custom-fields) represent custom data extensions that you can use with the Lockstep Platform. If you need to store extra information about an object that does not match Lockstep’s official schema, you can store it in the Custom Field system using CustomFieldSyncModel.
To store a custom field for an object, create a CustomFieldSyncModel record containing the ‘TableKey` and `ErpKey` of the entity to which you will attach a custom field. Next specify the field’s ‘CustomFieldLabel` and either a `StringValue` or `NumericValue`.
Once imported, this record will be available in the Lockstep API as a [CustomFieldValueModel](developer.lockstep.io/docs/customfieldvaluemodel).
For more information on writing your own connector, see [Connector Data](developer.lockstep.io/docs/connector-data).
Instance Attribute Summary collapse
-
#created ⇒ Date-time
If known, the date when this record was created according to the originating financial system in which this record is maintained.
-
#custom_field_label ⇒ String
A label that uniquely identifies this custom field within your software.
-
#erp_key ⇒ String
This is the primary key of the record to which you will attach this custom field.
-
#modified ⇒ Date-time
If known, the date when this record was most recently modified according to the originating financial system in which this record is maintained.
-
#numeric_value ⇒ Double
The value of this custom field, if it is stored in numeric format.
-
#string_value ⇒ String
The value of this custom field, if it is stored in string format.
-
#table_key ⇒ String
Custom Fields are identified by the ‘TableKey` and `ErpKey` values together.
-
#value ⇒ String
The value of this custom field.
Instance Method Summary collapse
-
#as_json(options = {}) ⇒ object
This object as a JSON key-value structure.
-
#initialize(params = {}) ⇒ CustomFieldSyncModel
constructor
Initialize the CustomFieldSyncModel using the provided prototype.
-
#to_json(*options) ⇒ String
This object converted to a JSON string.
Constructor Details
#initialize(params = {}) ⇒ CustomFieldSyncModel
Initialize the CustomFieldSyncModel using the provided prototype
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/lockstep_sdk/models/custom_field_sync_model.rb', line 37 def initialize(params = {}) @erp_key = params.dig(:erp_key) @table_key = params.dig(:table_key) @custom_field_label = params.dig(:custom_field_label) @string_value = params.dig(:string_value) @numeric_value = params.dig(:numeric_value) @value = params.dig(:value) @created = params.dig(:created) @modified = params.dig(:modified) end |
Instance Attribute Details
#created ⇒ Date-time
Returns If known, the date when this record was created according to the originating financial system in which this record is maintained. If the originating financial system does not maintain a created-date, leave this field null.
74 75 76 |
# File 'lib/lockstep_sdk/models/custom_field_sync_model.rb', line 74 def created @created end |
#custom_field_label ⇒ String
Returns A label that uniquely identifies this custom field within your software. Example: You have an invoice whose ID number is 100047878, and you wish to store a custom field on that invoice named “ApprovalStatusCode”. For the ‘CustomFieldLabel` field, specify the value `ApprovalStatusCode`.
58 59 60 |
# File 'lib/lockstep_sdk/models/custom_field_sync_model.rb', line 58 def custom_field_label @custom_field_label end |
#erp_key ⇒ String
Returns This is the primary key of the record to which you will attach this custom field. You should provide the identifying number as it is stored in the originating financial system. Search for a unique, non-changing number within the originating financial system for this record. Custom Fields are identified by the ‘TableKey` and `ErpKey` values together. Example: You have an invoice whose ID number is 100047878, and you wish to store a custom field on that invoice named “ApprovalStatusCode”. For the `ErpKey` field, specify the value `100047878`. For more information, see [Identity Columns](developer.lockstep.io/docs/identity-columns).
50 51 52 |
# File 'lib/lockstep_sdk/models/custom_field_sync_model.rb', line 50 def erp_key @erp_key end |
#modified ⇒ Date-time
Returns If known, the date when this record was most recently modified according to the originating financial system in which this record is maintained. If the originating financial system does not maintain a most-recently-modified-date, leave this field null.
78 79 80 |
# File 'lib/lockstep_sdk/models/custom_field_sync_model.rb', line 78 def modified @modified end |
#numeric_value ⇒ Double
Returns The value of this custom field, if it is stored in numeric format.
66 67 68 |
# File 'lib/lockstep_sdk/models/custom_field_sync_model.rb', line 66 def numeric_value @numeric_value end |
#string_value ⇒ String
Returns The value of this custom field, if it is stored in string format.
62 63 64 |
# File 'lib/lockstep_sdk/models/custom_field_sync_model.rb', line 62 def string_value @string_value end |
#table_key ⇒ String
Returns Custom Fields are identified by the ‘TableKey` and `ErpKey` values together. Example: You have an invoice whose ID number is 100047878, and you wish to store a custom field on that invoice named “ApprovalStatusCode”. For the `TableKey` field, specify the value `Invoice`. Recognized types include: * `Company` - Link this custom field to a CompanySyncModel * `Contact` - Link this custom field to a ContactSyncModel * `Invoice` - Link this custom field to an InvoiceSyncModel * `InvoiceLine` - Link this custom field to an InvoiceLineSyncModel * `Payment` - Link this custom field to a PaymentSyncModel.
54 55 56 |
# File 'lib/lockstep_sdk/models/custom_field_sync_model.rb', line 54 def table_key @table_key end |
#value ⇒ String
Returns The value of this custom field.
70 71 72 |
# File 'lib/lockstep_sdk/models/custom_field_sync_model.rb', line 70 def value @value end |
Instance Method Details
#as_json(options = {}) ⇒ object
Returns This object as a JSON key-value structure.
82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/lockstep_sdk/models/custom_field_sync_model.rb', line 82 def as_json(={}) { 'erpKey' => @erp_key, 'tableKey' => @table_key, 'customFieldLabel' => @custom_field_label, 'stringValue' => @string_value, 'numericValue' => @numeric_value, 'value' => @value, 'created' => @created, 'modified' => @modified, } end |
#to_json(*options) ⇒ String
Returns This object converted to a JSON string.
97 98 99 |
# File 'lib/lockstep_sdk/models/custom_field_sync_model.rb', line 97 def to_json(*) "[#{as_json(*).to_json(*)}]" end |