Retrieves the value of a password field from a specific document.

This function performs an asynchronous request to the server to fetch the value of a password field from a document. The field whose value is to be retrieved is specified by the fieldname parameter. The document is identified by its type (doctype) and name (docname).

Note: Handling of sensitive information like passwords should be done with caution to ensure data security and privacy.

// Retrieve the password for an 'Employee' document.
const passwordParams: getPasswordParams = {
doctype: 'Employee',
docname: 'EMP-001',
fieldname: 'employee_password',
};
const employeePassword = await getPassword(passwordParams);
console.log(employeePassword); // Logs the password value for the 'Employee' document
// Retrieve the password for a 'User' document.
const passwordParams: getPasswordParams = {
doctype: 'User',
docname: 'USR-123',
fieldname: 'user_password',
};
const userPassword = await getPassword(passwordParams);
console.log(userPassword); // Logs the password value for the 'User' document
// Retrieve the password for a 'Vendor' document.
const passwordParams: getPasswordParams = {
doctype: 'Vendor',
docname: 'VEN-456',
fieldname: 'vendor_password',
};
const vendorPassword = await getPassword(passwordParams);
console.log(vendorPassword); // Logs the password value for the 'Vendor' document

Throws an error if the request fails or if there is an issue with retrieving the password.

  • Parameters

    • params: getPasswordParams

      The parameters for retrieving the password field value. This includes:

      • doctype: The type of document from which the password value is to be retrieved.
      • docname: The name or identifier of the document.
      • fieldname: The name of the field that contains the password value.

    Returns Promise<string | number>

    A promise that resolves to the value of the password field, which can be a string or number depending on the field configuration.