I know that a can create a new costumer via OCAPI call:

POST https://hostname:port/dw/data/v19_3/customer_lists/{list_id}/customers

But in the Credentials document there is no password to be specified or a setting for the "Send Password Update Mail" option I have in the BM.

How can I notify the customer that the account has been created so that he can change/set their password?


Within the dw.ocapi.data.customer_list.customers.afterPOST hook you can trigger an email with a password reset token link within it. Alternatively, you could create the link and return it in a flash message or via a custom property in the response JSON.

In order to retrieve the password reset token, you'd need to call the createResetPasswordToken() method of the dw.customer.Credentials class instance that represents the Customer Profile's credentials. This can be retrieved in the customers.afterPOST hook like so:

const Status = require('dw.system.Status');

function handleAfterPOST(customer, responseObj, customerListID) {
  let credentials = customer.getProfile().getCredentials();
  let token;

  if (!empty(credentails)) {
    token = credentials.createResetPasswordToken();

  if (!empty(token)) {
    // add token to response object, send an email, or something like that...
    responseObj.c_reset_token = token;
    return new Status(Satus.OK);
  } else {
    return new Status(Status.ERROR);

Of course, your hook handler would need to be registered in your hooks.json file.

  • 1
    Thank you for your extended answer and the example, I might have imagined that being easier, but I'll get to work trying your suggesting.
    – empiric
    Apr 17 '19 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.