/* * Custom Object Creation Workflow - a minimal workflow manifest example. * * Defines one Custom Object (`intake_request__c`) and one Workflow Studio * workflow that runs when an intake request record is created. * * Run: * yarn tsn examples/manifest/custom-object-creation-workflow/custom-object-creation-workflow.ts \ * > examples/manifest/custom-object-creation-workflow/manifest.json */ import { Category, CustomObject, CustomObjectFieldSection, ManifestBuilder, ManifestFunction, SelectField, Workflow, } from '@rippling/rippling-sdk/lib/manifest'; const manifest = new ManifestBuilder({ key: 'custom_object_creation_workflow', name: 'Custom Object Creation Workflow', description: 'A minimal workflow that triggers when a custom object record is created', }); const category = new Category(manifest, { apiName: 'intake__c', name: 'Intake', description: 'Intake workflow records', }); const intakeRequest = new CustomObject(manifest, { apiName: 'intake_request__c', name: 'Intake request', pluralLabel: 'Intake requests', category, description: 'Request submitted for workflow processing', }); const detailsSection = new CustomObjectFieldSection(intakeRequest, { name: 'Details', sectionId: 'sec_intake_request_details', }); new SelectField(intakeRequest, { apiName: 'status__c', displayName: 'Status', description: 'Request status', options: ['New', 'In review', 'Complete'], required: true, section: detailsSection, }); const workflowFn = new ManifestFunction(manifest, { apiName: 'intake_request_created_fn', name: 'Intake request created function', description: 'Function run when a new intake request is created', }); new Workflow(manifest, { definitionId: 'intake_request_created_workflow', title: 'Intake request created', description: 'Runs when a new intake request is created', function: workflowFn, trigger: { automation_event_type: 'AUTOMATION_EVENT_TYPE_RECORD_CHANGE', og_module: 'custom_objects', base_model: intakeRequest.getApiName(), record_change_operation_type: 'RECORD_CHANGE_OPERATION_TYPE_CREATE', }, }); console.log(manifest.preview());