Yes, this is possible. You'll just need to construct the OpportunityLineItem from it's sObject type and you'll start with your custom currency field populated.
OpportunityLineItem line =
recordTypeId, // optionally set a record type
true); // loadDefaultValues
There are lot more details on it in the usages tips are from the docs
- For required fields that have no default values, make sure to provide a value before inserting the new sObject. Otherwise, the
insertion results in an error. An example is the Account Name field or
a master-detail relationship field.
- Since picklists and multi-select picklists can have default values specified per record type, this method populates the default value
corresponding to the record type specified.
- If fields have no predefined default values and the loadDefaults argument is true, this method creates the sObject with field values of
- If the loadDefaults argument is false, this method creates the sObject with field values of null.
- This method populates read-only custom fields of the new sObject with default values. You can then insert the new sObject with the
read-only fields, even though these fields cannot be edited after
- If a custom field is marked as unique and also provides a default value, inserting more than one new sObject will cause a run-time
exception because of duplicate field values.