Best Practices for SuiteCloud Developer Assistant

The following best practices are intended to help minimize errors and enhance the quality of results you receive from SuiteCloud Developer Assistant. Keep in mind that these best practices may not completely prevent inaccuracies or hallucinations from large language models (LLMs).

Security and Compliance

Prompt Quality and Usage

Code and Solution Quality

Integration and Configuration

Troubleshooting and Support

Continuous Learning and Feedback

Unit Testing Best Practices

Prompt Examples

To get the most out of SuiteCloud Developer Assistant, enter your prompts directly in the Cline chat window within your Visual Studio Code (VS Code) environment.

  1. In VS Code, open the Cline panel. You can do this in two ways:

    • Open the Command Palette using Ctrl+Shift+P in Windows or Cmd+Shift+P in macOS and Linux, then type Cline: Jump to Chat Input.

    • Click the Cline icon in the activity bar.

  2. Type or paste your request in the prompt field. For example, ask Cline to generate SuiteScript code, create SuiteCloud project structures, or explain best practices. The assistant responds inline with generated code or explanations, which you can then review, modify, and insert into your SuiteCloud project.

The following examples illustrate the types of prompts you can use to interact with SuiteCloud Developer Assistant through Cline:

  1. I need to create a client script that validates a custom field on Purchase Orders called custbody_approval_limit (a currency field). The validation should check if the PO total exceeds the employee's approval limit, which is stored in custentity_po_approval_limit on their Employee record. Show me the complete SuiteScript 2.1 client script with proper error handling.

  2. Create a Map/Reduce script that processes large volumes of sales data to calculate commission splits for multiple sales representatives per transaction. The script should handle complex commission structures based on product categories, customer tiers, and territory assignments. Include detailed reporting and integration with payroll systems.

  3. Layout a custom record type for Quality Control Inspections with fields for inspection criteria, test results, inspector assignments, and approval status. Create associated workflows for routing inspections based on item categories, and user event scripts that update item quality ratings. Include the complete SDF structure.

  4. I'm building a SuiteCloud project for project management. Create the SDF structure for a custom record called Project Milestone with fields for milestone name, due date, completion percentage, assigned resources (employee list), and dependencies (references to other milestones). Include the manifest.xml file, custom forms, and a user event script that automatically updates project completion based on milestone progress.

  5. I need a Suitelet that generates complex manufacturing work orders with multi-level BOM explosions, resource scheduling, and capacity planning. The interface should support drag-and-drop scheduling, visual capacity indicators, and integration with shop floor systems. Include proper validation for resource conflicts and material availability.

  6. I've got a SuiteScript 2.1 client script that validates a custom field, custbody_approval_limit, on Purchase Orders. The validation ensures the PO total does not exceed the employee's approval limit from custentity_po_approval_limit on their Employee record. Write comprehensive unit tests for this validation logic, covering scenarios where the PO total is below, equal to, and above the approval limit. Use a standard SuiteScript 2.1 testing framework (such as Jest), and include mock data and expected outcomes for each scenario.

  7. In SuiteScript 2.1, I often see a comment block at the top of scripts that includes an @file annotation. Can you explain the purpose and intended usage of the @file annotation in SuiteScript files, including any best practices for completing this field? See an example below:

                    /**
     * @NApiVersion 2.1
     * @NScriptType ClientScript
     * @file po_approval_validation.js
     * @author Jane Doe
     * @description Validates Purchase Order approval limits
     */ 
    
                  
  8. I have a SuiteScript 2.1 client script function that validates whether the purchase order total exceeds the employee's approval limit. However, when the field custentity_po_approval_limit is undefined or missing on the Employee record, the script throws an error and the validation fails. Review the following function, identify any issues, and provide a corrected version that safely handles cases where the approval limit is missing or not set, using appropriate error handling and user feedback. Suggest improvements based on SuiteScript 2.1 best practices.

                    function validateApprovalLimit(poTotal, employeeRecord) {
        var approvalLimit = employeeRecord.getValue({ fieldId: 'custentity_po_approval_limit' });
        if (poTotal > approvalLimit) {
            alert('PO total exceeds the approval limit!');
            return false;
        }
        return true;
    } 
    
                  

Related Topics

General Notices