You need to sign in to do that
Don't have an account?
sfdc007
Trigger Req help needed
Hi,
I have a requirement for insert trigger i need help on it
1) I have a custom object called as Suppressed Domain__c , where there are 2 fields like" Isactive" and "Domain"
2) I want to write a trigger for the below condition which i need help on it
a) If "IsActive" is true then query contacts and leads with the same email domain
if records found(Yes)
there is another custyom object called as blacklist which i need to the following custom filds
set suppressed domain = true,
optout = true and
opt in = no opt in
if no records found , then set
set suppressed domain = true,
optout = true and
opt in = no opt in
email :temp dummy @dmain.com
kindly let me know how to achieve this with the code pls
Thanks in Advance
I have a requirement for insert trigger i need help on it
1) I have a custom object called as Suppressed Domain__c , where there are 2 fields like" Isactive" and "Domain"
2) I want to write a trigger for the below condition which i need help on it
a) If "IsActive" is true then query contacts and leads with the same email domain
if records found(Yes)
there is another custyom object called as blacklist which i need to the following custom filds
set suppressed domain = true,
optout = true and
opt in = no opt in
if no records found , then set
set suppressed domain = true,
optout = true and
opt in = no opt in
email :temp dummy @dmain.com
kindly let me know how to achieve this with the code pls
Thanks in Advance
Please refer the bewlo code and correct the API names as I am not aware abou the names...please chcek and let me kniw if it helos..
Thanks,
Sandeep
All Answers
there is another custyom object called as blacklist which i need to the following custom filds
from above line, is this related to the doman__c object on which we are writting trigger ?
kindly help me on this regard
what is the relationship between blacklist object and lead adn contact?
i just have to verify the emails in both lead and contact are having same domains and then is so i have to update the fields on blacklist object
they are independent to each other
Okat lets take one example:
I am inserting 3 Suppressed_Domain__c object okay where isActive is true ..
1. Suppressed_Domain__c 1 - email is s@ss.com - conatc and lead found 2 with same domain ----?? new blacklist object you will create here ?
2. Suppressed_Domain__c 2 - email is s@34.com - contact and lead found 1 with same domain --- ??new object or you will update existing one
3. Suppressed_Domain__c 3 - email is 5@34444.com - 0 contact and lead found --- ??
Please check above example and let me know what you need
if I have 3 domain object and they are having different email and we found different conatc and lead for all, then which blacklist obhecjt should create or update for whihc??
Thanks,
Sandeep
1. Suppressed_Domain__c 1 - email is s@ss.com - conatc and lead found 2 with same domain ----?? new blacklist object you will create here ?
in case 1 if both are matching i have to update the following fields in blacklist object as follows
set suppressed domain = true,
optout = true and
opt in = no opt in
if no records found , then set
set suppressed domain = true,
optout = true and
opt in = no opt in
email :temp dummy @dmain.com
3. Suppressed_Domain__c 3 - email is 5@34444.com - 0 contact and lead found --- ??
case 3:
i can leave it as it is as the email domains are not matching(no insert needed)
hope it helps
insert -> is active true ->yes -> query contact and leads with same email domain -> records found -> yes -> Upsert unique emails to
Blacklist:
Suppressed Domain = TRUE
Opt Out = TRUE
Opt In = No Opt In
insert -> is active true ->yes -> query contact and leads with same email domain -> records found -> No->Insert Dummy Record in Blacklist table
Suppressed Domain = TRUE
Opt Out = TRUE
Opt In = No Opt In
Email: tempDummy@
if for all records we are creating newly blacklist record with values then it is simple ...but if you are updating means which record you should update ??
we are creating a new blacklist record if the condition is met sandeep thats it , no upsert the existing ones on blacklist object
Please refer the bewlo code and correct the API names as I am not aware abou the names...please chcek and let me kniw if it helos..
Thanks,
Sandeep
I tried the following code
getting the error
Error: Compile Error: Incompatible value type String for Map at line 12 column 13
line 12 is
mapActiveIdToDOmain.put(objDomain.Id, objDomain.Domain__c);
kindly help me on this regard
Thanks
Apex script unhandled trigger exception by user/organization: 005U0000003gI34/00DJ0000003P150 Source organization: 00DU0000000HiA8 (null)
VCESSuppressedDomaininsert: execution of AfterInsert
caused by: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Email Address]: [Email Address]
Trigger.VCESSuppressedDomaininsert: line 50, column 1
line 50 :
insert lstBlackListObject;
active and domain
email address is from blacklist object only
no iea why this error is thrwong