You need to sign in to do that
Don't have an account?
Ragula Sivakumar
We are using survey monkey to capture Prospect based on survey . Once they completed the survey the Prospects along with survey responses will capture in sales cloud.
We are using survey monkey to capture Prospect based on survey . Once they completed the survey the Prospects along with survey responses will capture in sales cloud.
we will like to import only if the question answer is yes then corresponding prospects will transferred to CRM.
Somehow i have tried with this code and i tired also using bulk upload and its is working without any error.
Can someone let me know if i need to modify anything ?.
trigger deletesurvey1 on Survey_response__c (After insert) {
if(Trigger.isAfter){
//if (Trigger.isDelete){
Survey_response__c[] AllChildRecords = [Select id, Lead__c From Survey_response__c Where Survey_Question__c=:Label.Question and Response__c=:Label.Response];
List<id>leadlist= New List<id>();
if(AllChildRecords.size()>0){
for(Survey_response__c rec : AllChildRecords){
leadlist.add(rec.Lead__c);
}
}
List<Survey_response__c>surveyres= New List<Survey_response__c>();
for(Survey_response__c rec1 : [select id from Survey_response__c where Lead__c IN:leadlist]){
surveyres.add(rec1);
}
delete surveyres;
delete [select id from Lead where id IN :leadlist]
we will like to import only if the question answer is yes then corresponding prospects will transferred to CRM.
Somehow i have tried with this code and i tired also using bulk upload and its is working without any error.
Can someone let me know if i need to modify anything ?.
trigger deletesurvey1 on Survey_response__c (After insert) {
if(Trigger.isAfter){
//if (Trigger.isDelete){
Survey_response__c[] AllChildRecords = [Select id, Lead__c From Survey_response__c Where Survey_Question__c=:Label.Question and Response__c=:Label.Response];
List<id>leadlist= New List<id>();
if(AllChildRecords.size()>0){
for(Survey_response__c rec : AllChildRecords){
leadlist.add(rec.Lead__c);
}
}
List<Survey_response__c>surveyres= New List<Survey_response__c>();
for(Survey_response__c rec1 : [select id from Survey_response__c where Lead__c IN:leadlist]){
surveyres.add(rec1);
}
delete surveyres;
delete [select id from Lead where id IN :leadlist]
if question is "abcd" and response is "no" deleting the lead and corresponding survey's