Hello,
My first time coding in deluge and its...not...working.
I am trying to compare the entered zip code with a list and if its on that list set the custom variable "Territory" (which is a pick list)
BellevueZips = List:String();
BellevueZips = {98004,98005,98007,98008,98009,98011,98014,98015,98019,98024,98028,98029,98033,98034,98039,98041,98045,98052,98053,98065,98072,98073,98074,98075,98077,98083};
MtVernonZips = List:String();
MtVernonZips = {98201,98203,98204,98206,98207,98208,98213,98220,98221,98223,98225,98226,98227,98228,98229,98230,98231,98232,98233,98235,98236,98238,98239,98240,98247,98248,98249,98252,98253,98255,98257,98258,98259,98260,98262,98263,98264,98266,98270,98271,98272,98273,98274,98275,98276,98277,98282,98284,98287,98290,98291,98292,98293,98294,98295,98296};
BallardZips = List:String();
BallardZips = {98012,98020,98021,98026,98036,98037,98043,98046,98082,98087,98102,98103,98105,98107,98112,98113,98115,98117,98125,98127,98133,98145,98155,98160,98165,98175,98177,98195};
SeattleZips = List:String();
SeattleZips = {98006,98027,98040,98050,98055,98056,98057,98058,98059,98062,98101,98104,98106,98108,98109,98111,98114,98116,98118,98119,98121,98122,98124,98126,98129,98131,98134,98136,98138,98139,98141,98144,98146,98148,98154,98158,98161,98164,98166,98168,98170,98174,98178,98181,98185,98188,98190,98191,98194,98199};
TacomaZips = List:String();
TacomaZips = {98001,98002,98003,98010,98022,98023,98025,98030,98031,98032,98035,98038,98042,98047,98051,98063,98064,98071,98089,98092,98093,98198,98321,98323,98329,98332,98335,98338,98344,98352,98354,98360,98371,98372,98373,98374,98375,98385,98387,98388,98390,98391,98395,98396,98401,98402,98403,98404,98405,98406,98407,98408,98409,98411,98412,98413,98415,98416,98417,98418,98419,98421,98422,98424,98438,98439,98443,98444,98445,98446,98447,98448,98464,98465,98466,98467,98471,98481,98490,98493,98496,98497,98498,98499};
zipcode = zipcode;
if(BellevueZips.contains(zipcode))
{
upresp = zoho.crm.updateRecord("Leads",leadId,{"Territory":"WA - Bellevue"});
}
else if(MtVernonZips.contains(zipcode))
{
upresp = zoho.crm.updateRecord("Leads",leadId,{"Territory":"WA - Mt Vernon"});
}
else if(BallardZips.contains(zipcode))
{
upresp = zoho.crm.updateRecord("Leads",leadId,{"Territory":"WA - Ballard"});
}
else if(SeattleZips.contains(zipcode))
{
upresp = zoho.crm.updateRecord("Leads",leadId,{"Territory":"WA - Seattle"});
}
else if(TacomaZips.contains(zipcode))
{
upresp = zoho.crm.updateRecord("Leads",leadId,{"Territory":"WA - Tacoma"});
}
else
{
upresp = zoho.crm.updateRecord("Leads",leadId,{"Territory":"Unassigned"});
}