Credit1finance New Submit Button Redirection Rules

PHOTO EMBED

Fri Nov 10 2023 17:37:48 GMT+0000 (Coordinated Universal Time)

Saved by @nikanika4425

const {
    array_totalUnsecuredDebt,
    array_credit_score,
    array_number_of_collections,
    array_number_of_delinquencies,
    fname,
    lname,
    zip_code,
    address_street,
    'email-address': email,
    'phone-number': mobile,
    'loan-amount-slider': loanAmountSlider,
    partner // Assuming you have a field named 'partner' in Feathery
} = feathery.getFieldValues();

// Combined First and Second Button Conditions
if (
    array_totalUnsecuredDebt >= 14000 &&
    array_credit_score >= 520 &&
    array_number_of_collections <= 6 &&
    array_number_of_delinquencies <= 6 &&
    array_totalUnsecuredDebt !== null &&
    array_credit_score !== null &&
    array_number_of_collections !== null
) {
    console.log("Redirecting to Webflow thank-you page");
    const thankYouURL = `https://www.credit1finance.com/survey-bot?fname=${fname}&lname=${lname}&email=${email}&phone=${mobile}&partner=${partner}`;
    location.href = thankYouURL;
}

// Third Button Conditions - Redirect only if partner is 'NW'
else if (
    partner === 'NW' // Check if partner is 'NW'
) {
    console.log("Redirecting to StrikeDM link for NW partner");
    const refValue = `websitelead--${fname}--394917--${fname}--436574--${lname}--354744--${email}--46793--${phone}--142022--${partner}`;
    location.href = `https://app.strikedm.com/webchat/?p=1318036&ref=${refValue}`;
}

// Final Redirection for all other cases
else {
    console.log("Redirecting to default thank-you page");
    location.href = "https://www.credit1finance.com/thank-you-np";
}
content_copyCOPY