{"id":2617,"date":"2017-08-21T15:18:22","date_gmt":"2017-08-21T15:18:22","guid":{"rendered":"https:\/\/answers.gurussolutions.com\/answers\/how-to-apply-a-gift-certificate-to-a-sales-order-in-netsuite-suitescript-2\/"},"modified":"2026-07-28T18:25:04","modified_gmt":"2026-07-28T18:25:04","slug":"comment-appliquer-un-cheque-cadeau-a-une-commande-client-dans-netsuite-suitescript","status":"publish","type":"qa_entry","link":"https:\/\/answers.gurussolutions.com\/fr\/answers\/comment-appliquer-un-cheque-cadeau-a-une-commande-client-dans-netsuite-suitescript\/","title":{"rendered":"Comment appliquer un ch\u00e8que-cadeau \u00e0 une commande client dans NetSuite SuiteScript"},"content":{"rendered":"","protected":false},"template":"","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kadence_starter_templates_imported_post":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","ga_subtitle":"Automatisez l'application des ch\u00e8ques-cadeaux aux commandes client \u00e0 l'aide de SuiteScript afin de rationaliser le traitement des commandes.","ga_short_answer":"Pour appliquer un ch\u00e8que-cadeau \u00e0 une commande client dans SuiteScript, utilisez des fonctions telles que `record.setSublistValue` ou `record.setCurrentSublistValue` afin de remplir la sous-liste d\u2019utilisation du ch\u00e8que-cadeau. Cela implique de d\u00e9finir le code d\u2019autorisation et le montant \u00e0 appliquer, afin de garantir une int\u00e9gration correcte avec les workflows de traitement des commandes client.","ga_scenario":"Les entreprises ont souvent besoin d\u2019<a class=\"ga-interlink\" href=\"https:\/\/answers.gurussolutions.com\/fr\/answers\/how-do-user-event-scripts-handle-record-values-during-csv-imports\/\">appliquer<\/a> par programmation des ch\u00e8ques-cadeaux aux commandes client au sein de NetSuite. Cette automatisation est essentielle pour rationaliser les processus de traitement des commandes et garantir l\u2019exactitude des transactions financi\u00e8res lorsque les clients utilisent des ch\u00e8ques-cadeaux comme moyen de paiement. L\u2019application manuelle de ces ch\u00e8ques-cadeaux peut s\u2019av\u00e9rer chronophage et source d\u2019erreurs, ce qui rend n\u00e9cessaire le recours \u00e0 une solution SuiteScript.","ga_solution":"Pour appliquer par programmation un ch\u00e8que-cadeau \u00e0 une commande client, il convient d\u2019utiliser des fonctions SuiteScript 2.x telles que `record.setSublistValue`\n\nou `record.setCurrentSublistValue`\n\n. Les identifiants internes sp\u00e9cifiques \u00e0 la sous-liste d\u2019utilisation du ch\u00e8que-cadeau et \u00e0 ses champs (par exemple, pour le code d\u2019autorisation et le montant appliqu\u00e9) doivent \u00eatre v\u00e9rifi\u00e9s dans le Navigateur d\u2019enregistrements NetSuite pour la version actuelle du compte. Une approche courante consiste \u00e0 d\u00e9finir le code d\u2019autorisation et le montant \u00e0 appliquer sur la ligne correspondante de la sous-liste.\n\nVoici un exemple illustrant la mani\u00e8re dont cela pourrait \u00eatre mis en \u0153uvre, en supposant que les identifiants internes soient corrects et que l\u2019enregistrement soit en mode dynamique ou standard :\n\n```\njavascript\n\/\/ Assuming 'salesOrderRecord' is a loaded or created record object\n\/\/ and 'giftCertInternalId', 'giftCertAmount' are defined variables.\n\n\/\/ IMPORTANT: The sublist ID 'giftcertredemption' and field IDs 'authcode', 'authcodeapplied'\n\/\/ are examples from SuiteScript 1.0 and require verification in the NetSuite Records Browser\n\/\/ for SuiteScript 2.x to ensure correct functionality in your specific environment.\n\/\/ Sublist lines are typically 0-indexed in SuiteScript 2.x.\n\nsalesOrderRecord.setSublistValue({\n    sublistId: 'sublist_id_for_gift_certificate_redemption', \/\/ e.g., 'giftcertredemption'\n    fieldId: 'field_id_for_authorization_code', \/\/ e.g., 'authcode'\n    line: 0, \/\/ Adjust line index as needed; 0 for the first line\n    value: giftCertInternalId\n});\n\nsalesOrderRecord.setSublistValue({\n    sublistId: 'sublist_id_for_gift_certificate_redemption', \/\/ e.g., 'giftcertredemption'\n    fieldId: 'field_id_for_applied_amount', \/\/ e.g., 'authcodeapplied'\n    line: 0, \/\/ Adjust line index as needed; 0 for the first line\n    value: giftCertAmount\n});\n```\n\nCette approche garantit que le code d\u2019autorisation du ch\u00e8que-cadeau et le montant \u00e0 appliquer sont correctement associ\u00e9s \u00e0 la commande client.","ga_source_author":"","ga_source_author_email":"","ga_date_original":"2017-08-21T11:18:22-04:00","ga_date_verified":"2026-07-05","ga_source_subject":"Applying a gift certificate on a Sales Order in SuiteScript","ga_ans_id":"ANS-0878","ga_publish_decision":"publish_with_edits","ga_staleness_risk":"high","ga_review_priority":"spot_check","ga_tier2_verdict":"partially_outdated","ga_tier2_concerns":"The function `record.setLineItemValue` is a SuiteScript 1.0 function and has been superseded by `record.setSublistValue` or `record.setCurrentSublistValue` in SuiteScript 2.x.; The specific internal IDs 'giftcertredemption' for the sublist and 'authcode', 'authcodeapplied' for the fields are not explicitly confirmed in current SuiteScript 2.x documentation for applying gift certificates on sales orders.","ga_final_category":"SuiteScript Development","footnotes":""},"ga_category":[108,23,108],"ga_audience":[10],"ga_difficulty":[92],"class_list":["post-2617","qa_entry","type-qa_entry","status-publish","hentry","ga_category-developpement-suitescript","ga_category-suitescript-development","ga_audience-developer-suitescript","ga_difficulty-niveau-intermediaire"],"taxonomy_info":{"ga_category":[{"value":108,"label":"D\u00e9veloppement SuiteScript"},{"value":23,"label":"SuiteScript Development"},{"value":108,"label":"D\u00e9veloppement SuiteScript"}],"ga_audience":[{"value":10,"label":"Developer\/SuiteScript"}],"ga_difficulty":[{"value":92,"label":"Niveau interm\u00e9diaire"}]},"featured_image_src_large":[],"author_info":[],"comment_info":"","_links":{"self":[{"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/qa_entry\/2617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/qa_entry"}],"about":[{"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/types\/qa_entry"}],"version-history":[{"count":1,"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/qa_entry\/2617\/revisions"}],"predecessor-version":[{"id":4537,"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/qa_entry\/2617\/revisions\/4537"}],"wp:attachment":[{"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/media?parent=2617"}],"wp:term":[{"taxonomy":"ga_category","embeddable":true,"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/ga_category?post=2617"},{"taxonomy":"ga_audience","embeddable":true,"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/ga_audience?post=2617"},{"taxonomy":"ga_difficulty","embeddable":true,"href":"https:\/\/answers.gurussolutions.com\/fr\/wp-json\/wp\/v2\/ga_difficulty?post=2617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}