Overview
Nue offers a dual-platform, which means Nue’s platform stores and manages data from 2 different SaaS Platforms - Salesforce & Nue’s Cloud Services.
If your Nue instance is connected to a Salesforce org, all the objects that support products and pricing have Salesforce as the only data source.
You can use Nue’s graphQL service to access the data of any objects in Nue. If the object has Salesforce as the data source, the data will be queried from Salesforce. Otherwise, the data will be retrieved from Nue Services.
You can login to Nue and navigate to Settings > Business Objects, and see a list of objects in Nue. For any object in the list, if Salesforce API Name is not empty, the object has Salesforce as the data source.
Figure 1: Business Objects
Create Custom Fields
So to create custom fields in Nue that has Salesforce as the data source, you will need to create custom fields in Salesforce, and then synchronize the custom fields to Nue.
Create Custom Field in Salesforce
To create a custom field in Salesforce, you can login to the connected Salesforce Org and click Setup > Object Manager, and select the object. For example, ‘Product’. Then click Fields and Relationships, and click ‘New’ to create a new custom field.
Please note that Nue requires a custom field to have at least 5 characters in length. We’ll soon remove this limitation in the upcoming release.
Add Custom Field to Field Set
Now click ‘Field Set’ and click to open the field set ‘Fields Exposed to Nue’. Add the newly created custom fields to this field set. Please note that only fields added to this field set can be synchronized to Nue.
Figure 2: Add Custom Fields to the Field Set
Repeat the above 2 steps to complete creating your custom fields. Please note that we currently support the custom fields sync to Nue for the following objects:
- Account
- Entity
- Product
- Price Book & Price Book Entry
- Feature (a.k.a. Product Group)
- Subscription
- Asset
- Entitlement
- Unit of Measure (UOM)
- Order & Order Product
- Invoice, Invoice Item & Invoice Item Detail
- Credit Memo, Credit Memo Item & Credit Memo Item Detail
Synchronize Custom Fields to Nue
To synchronize custom fields from Salesforce to Nue, please follow the steps below:
1. Login to Nue App, and navigate to System Settings
2. Search for "Business Objects"
3. Click on button "Sync Custom Fields from Salesforce".
Once the custom fields have been successfully synchronized from Salesforce to Nue, you should be able to view the custom fields available for the listed object.
Query Objects with Newly Created Custom Fields
You can now use graphQL to access the newly created and sync’ed custom fields, as if you’re querying standard fields.
In the following example that queries all active bundle products, ProductCost__c is a custom field on Product object.
query {
Product(where: {_and: [{configurable: {_eq: true}}, {status: {_eq: "Active"}}]}) {
autoRenew
configurable
defaultRenewalTerm
defaultSubscriptionTerm
defaultUomId
description
endDate
id
name
priceModel
productCategory
sku
startDate
status
ProductCost__c
}
}
Customize the Bundle or Product Layout in Nue
You can create a bundle or product custom field layout using the Create Layout API.
POST {{endpoint}}/metadata/layouts
- To create a custom field layout section for Product, use name Product_CustomFields
- To create a custom field layout section for Bundle, use name Bundle_CustomFields
In the following CURL example, a custom field layout is created for the Bundle Product containing one custom field ProductCost__c
.
curl --location 'https://api.nue.io/metadata/layouts' \
--header 'nue-api-key: {{nue-api-key}}' \
--header 'Content-Type: application/json' \
--data '{
"type": "FormView",
"apiName": "Bundle_CustomFields",
"name": "Bundle_CustomFields",
"objectApiName": "Product",
"content": "{\"layout\":[{\"apiName\":\"ProductCost__c\",\"xs\":\"6\"}]}",
"tags": ["Product", "CustomFields"]
}'
You can further customize the rendering of each custom field in the section using the following field properties:
"apiName": "API Name of the custom field",
"name": "The display name of the field",
"type": "boolean", //also support other display types
"creatable": true, //indicates if this field is read-only in the create layout
"updatable": true, //indicate if this field is read-only in the update layout
"inlineHelpText": "the help text",
"required": false
Verify the Custom Field Section
After successfully created the Bundle or Product custom field layout, you can create or edit a new product or bundle and verify the custom field section is appended to the end of the layout, as shown in the following example: