Luis
09/25/2024, 3:16 PMCeligo AI
09/25/2024, 3:17 PMAI generated answer (using internal Slack threads):To add a promotion to an item/sales order for orders created through scripts in non-dynamic mode, you would need to use the
record.submitFields
method. This method allows you to update specific fields on a record without loading the entire record into memory.
Here is a sample code snippet:
javascript
var salesOrderId = '123456'; // replace with your sales order internal id
var promotionId = '78910'; // replace with your promotion internal id
var id = record.submitFields({
type: record.Type.SALES_ORDER,
id: salesOrderId,
values: {
'promocode': promotionId
},
options: {
enableSourcing: false,
ignoreMandatoryFields : true
}
});
This code will update the 'promocode' field on the sales order with the internal id of the promotion.
Please note that this method will not trigger any business rules that would normally run when the record is edited in the UI. If you need to trigger these rules, you will need to load the record, make the changes, and then save the record.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
09/25/2024, 3:17 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.856980801
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.818638384
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.81194824
Celigo AI
09/25/2024, 3:17 PM