---
schema_version: "1"
id: 9d24a82e591b1d2a0428e9fec6189eb973c3286aabc30437c11f6362ddb704f4
title: LoadTaskConfiguration.ds
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/b2c-commerce/guides/inventory/b2c-load-task-configuration-ds.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/b2c-load-task-configuration-ds.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 2ba7bee6edb8fe702e8dca87d318a6fd0e86f56a78babf658a4acb5262fcaa92
products:
  - Composable Storefront
  - Salesforce APIs
---
# LoadTaskConfiguration.ds

LoadTaskConfiguration.ds loads the configuration for a task name from a custom object.

**note:** This code is provided as a sample. It isn't a supported part of the SiteGenesis application.

```
/**
 * Loads the configuration for the given task name from a custom object.
 *
 * @input TaskName  : String    Name of the configuration
 * @input sampleLogger  : Object    Sample logger input for Sample logger
 * @output TaskConfiguration  : dw.object.CustomObject    Configuration for the task
 * @output sampleLogger  : Object    Sample logger debug output for Sample logger
 * @output sampleError  : Object    Sample error output for Sample logger */
importPackage(dw.system);
importPackage(dw.object);

// Sample Logging ImportScript
importScript("bc_sample:library/common/libContext.ds");
importScript("bc_sample:library/utility/exception/libsampleException.ds");
importScript("bc_sample:library/utility/logging/libLog.ds");

var CUSTOM_OBJECT_NAME = "TASK_CONFIGURATION";

function execute(pdict: PipelineDictionary): Number {
    // Sample Logging var
    var _context: String = new Context("LoadTaskConfiguration.ds");
    var _logger: Log = Log.getLogger(pdict);

    var taskName: String = pdict.TaskName;

    try {
        var taskConfiguration: CustomObject = CustomObjectMgr.getCustomObject(CUSTOM_OBJECT_NAME, taskName);

        _logger.debug(_context, "Loaded task configuration '" + taskName + "'");

        pdict.TaskConfiguration = taskConfiguration;
    } catch (e) {
        // sample Logging wrap error into custom exception
        var exception: sampleException = new sampleException(_context, "Error occurred calling Task configuration ", e);



        // sample Logging call into error handler
        _logger.error(_context, "Error occurred calling Task configuration " + exception);
        pdict.sampleError = exception;



        return PIPELET_ERROR;
    }
    return PIPELET_NEXT;
}
```
