- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 10:45 AM
We need to sync contract data between one of our systems and ServiceNow. These contracts come with different currencies, so we added a field "u_amount" with type FX Currency in our contract table in ServiceNow.
Is there any way to get FX Currency fields populated using the REST API?
I understood, that using a Form to enter the FX amount and currency does some 'magic'. It does create a fx_currency2_instance dataset which is linked to the contract dataset. Is there any kind of payload (like
u_amount_fx: { 'amount': 100, currency: 'USD'}
) that does trigger the same 'magic' or do I have to create the structure by hand? So creating a new fx_currency2_instance dataset through REST and then link the sys_ids from both sets vice versa?
An example of the datastructure when entering a FX value in a form.
The two relevant fields from the contract
<ast_contract>
....
<sys_id>48597bab4730e9103545f3de436d4395</sys_id>
<u_amount_fx>2f8c98de4738b1903545f3de436d432c</u_amount_fx>
...
</ast_contract>
The relevant fields in the fx_currency2_instance table.
<fx_currency2_instance>
<amount>255</amount>
<currency>AUD</currency>
<field>u_amount_fx</field>
<parent_record>48597bab4730e9103545f3de436d4395</parent_record>
<sys_id>2f8c98de4738b1903545f3de436d432c</sys_id>
<table>ast_contract</table>
</fx_currency2_instance>
Thanks for ideas or best practices
Björn
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2023 12:12 PM
Ok, I solved it on my own. The value for an FX Currency field can be set using a payload that contains
u_amount_fx: "USD;123"
This does create a new enty in the fx_currency2_instance table and does link that entry to the u_amount_fx field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2023 12:12 PM
Ok, I solved it on my own. The value for an FX Currency field can be set using a payload that contains
u_amount_fx: "USD;123"
This does create a new enty in the fx_currency2_instance table and does link that entry to the u_amount_fx field.