Difference between revisions of "CG0129inz - FÆRGEN A/S Kundepanel - Import email info to base questionnaire"

From Catglobe Wiki
Jump to: navigation, search
(Step 2 :Prepare the workflow script for solving the uploaded data)
Line 37: Line 37:
 
array a = Workflow_getParameters();
 
array a = Workflow_getParameters();
 
string csvData = a[0];
 
string csvData = a[0];
 
+
number importtype = convertToNumber(a[1]);
number DCSRid = 1497859; // DCS : used for filtering the email. The real value should be : 1497858
+
number DCSRid = 1497858; // DCS : used for filtering the email. The real value should be : 1497858
number EmailgroupRid = 1497862; // EmailgroupRid : used for contatining the import Email.
+
number PQRid = 1289245; // PQRid: used for the imported PQ. The real value should be :  1289245
number PQRid = 1497857; // PQRid: used for the imported PQ. The real value should be :  1289245
+
number MailtemplateRid = 1497895; // MailtemplateRid: used for the mail template. The real value should be : 1497895
number bulkmailId = 1548; // bulkmailId : used for sending the invitation. The real value should be : 1549
 
 
DCS_use(DCSRid);  
 
DCS_use(DCSRid);  
 
DCS_rebuild();
 
DCS_rebuild();
//Sub workflows for data resolve
+
 
 +
number InvitationBmRid = 0;
 
number  info_wfrid = 1293521; //CG0129inz - FÆRGEN A/S Kundepanel - get info from the record on csv file
 
number  info_wfrid = 1293521; //CG0129inz - FÆRGEN A/S Kundepanel - get info from the record on csv file
 +
number  Creategroup_wfrid = 1308275; //CG0129inz - FÆRGEN A/S Kundepanel - Create group of recipients
 
number validate_info_wfrid = 1497863; //CG0129inz - FÆRGEN A/S Kundepanel - Validate the email csv info
 
number validate_info_wfrid = 1497863; //CG0129inz - FÆRGEN A/S Kundepanel - Validate the email csv info
number optimize_wfRid = 1497864; //CG0129inz - FÆRGEN A/S Kundepanel - Optimize the email csv record
+
//number optimize_wfRid = 1497864; //CG0129inz - FÆRGEN A/S Kundepanel - Optimize the email csv record
 +
number optimize_wfRid = 1605713; //CG0129inz - FÆRGEN A/S Kundepanel - Optimize the email csv record - ver 2
 
number createQAS_wfRid= 1497865; //CG0129inz - FÆRGEN A/S Kundepanel - create qas n base qnaire
 
number createQAS_wfRid= 1497865; //CG0129inz - FÆRGEN A/S Kundepanel - create qas n base qnaire
 
number import_wfRid= 1497867; //CG0129inz - FÆRGEN A/S Kundepanel - Import email data
 
number import_wfRid= 1497867; //CG0129inz - FÆRGEN A/S Kundepanel - Import email data
 +
number Bulkmail_wfRid = 1541304; // CG0129inz - FÆRGEN A/S Kundepanel - Do the mailout for recipients
 +
 +
// Create the new groups containing the respondent
 +
number groupTemplateResourceId = 773261; // standard group
 +
number parentResourceId =  1297798; // CG0129inz- Færgen KundeForum - group import
 +
number EmailgroupRid = Workflow_call(Creategroup_wfrid, {"CG0129inz - Færgen KundeForum - Import email to Base qnaire", parentResourceId , groupTemplateResourceId });
  
 
array currentdatetime = getCurrentDateTime(Timezone_Romance_Standard_Time);
 
array currentdatetime = getCurrentDateTime(Timezone_Romance_Standard_Time);
Line 67: Line 75:
 
  }
 
  }
 
}
 
}
 +
//addJournal(1497860,54,"Comment","before optimize_wfRid " + convertToString(addToSurvey));
 
if (isEmpty(addToSurvey) == false)  
 
if (isEmpty(addToSurvey) == false)  
 
{
 
{
 
//Remove the duplicate email
 
//Remove the duplicate email
 
addToSurvey = Workflow_call(optimize_wfRid,{addToSurvey});
 
addToSurvey = Workflow_call(optimize_wfRid,{addToSurvey});
 +
 
//create qas and import
 
//create qas and import
 
addToSurvey  = Workflow_call(createQAS_wfRid,{PQRid,EmailgroupRid,addToSurvey});
 
addToSurvey  = Workflow_call(createQAS_wfRid,{PQRid,EmailgroupRid,addToSurvey});
Workflow_call(import_wfRid,{addToSurvey,PQRid});
+
Workflow_call(import_wfRid,{addToSurvey,PQRid,importtype});
 
//send bulkmail
 
//send bulkmail
string guid = getResourceGuid(Resource_Type_BulkMail , bulkmailId);
+
InvitationBmRid  = Workflow_call(Bulkmail_wfRid,{"CG0129inz - Færgen KundeForum - Email Import To Base Qnaire Invitation",PQRid,MailtemplateRid,EmailgroupRid});
number bulkmailRid = getResourceUniqueIdFromGuid(guid);
+
 
BulkMail_send(bulkmailRid);
 
 
}
 
}
addJournal(1497860,54,"Comment","Import for " + convertToString(currentvalue) + " is done");
+
addJournal(1497860,54,"Comment","Import for " + convertToString(currentvalue) + " is done. The bulkmailRid "+ convertToString(InvitationBmRid) + " was sent out.");
 
</source>
 
</source>
 
  
 
==== Step 3&nbsp;: Execute the program to upload the file  ====
 
==== Step 3&nbsp;: Execute the program to upload the file  ====

Revision as of 09:55, 3 July 2012

General information



Site
inzights.catglobe.com
Catinét project no
0129inz
Client

How to send out reminders

Goal

This is a standard setup to import the file which contains the email address to the base questionnaire then send the invitation to the imported email.

How to do

The general solution is to execute the .exe program to upload the csv file. After it is uploaded, the workflow script will validate and import the uploaded info to the base questionnaire.

Step 1 : Create the list of email address

We create the ".csv" file containing the email address like

File containing the email address.jpg

Step 2 :Prepare the workflow script for solving the uploaded data

array a = Workflow_getParameters();
string csvData = a[0];
number importtype = convertToNumber(a[1]);
number DCSRid = 1497858; // DCS : used for filtering the email. The real value should be : 1497858
number PQRid = 1289245; // PQRid: used for the imported PQ. The real value should be :  1289245
number MailtemplateRid = 1497895; // MailtemplateRid: used for the mail template. The real value should be :  1497895
DCS_use(DCSRid); 
DCS_rebuild();

number InvitationBmRid = 0;
number  info_wfrid = 1293521; //CG0129inz - FÆRGEN A/S Kundepanel - get info from the record on csv file
number  Creategroup_wfrid = 1308275; //CG0129inz - FÆRGEN A/S Kundepanel - Create group of recipients
number validate_info_wfrid = 1497863; //CG0129inz - FÆRGEN A/S Kundepanel - Validate the email csv info
//number optimize_wfRid = 1497864; //CG0129inz - FÆRGEN A/S Kundepanel - Optimize the email csv record
number optimize_wfRid = 1605713; //CG0129inz - FÆRGEN A/S Kundepanel - Optimize the email csv record - ver 2
number createQAS_wfRid= 1497865; //CG0129inz - FÆRGEN A/S Kundepanel - create qas n base qnaire
number import_wfRid= 1497867; //CG0129inz - FÆRGEN A/S Kundepanel - Import email data
number Bulkmail_wfRid = 1541304; // CG0129inz - FÆRGEN A/S Kundepanel - Do the mailout for recipients

// Create the new groups containing the respondent
number groupTemplateResourceId = 773261; // standard group
number parentResourceId =  1297798; // CG0129inz- Færgen KundeForum - group import
number EmailgroupRid = Workflow_call(Creategroup_wfrid, {"CG0129inz - Færgen KundeForum - Import email to Base qnaire", parentResourceId , groupTemplateResourceId }); 

array currentdatetime = getCurrentDateTime(Timezone_Romance_Standard_Time);
number currentvalue = currentdatetime[DateTime_Year]*10000 + currentdatetime[DateTime_Month]*100 + currentdatetime[DateTime_Day];

//start get the upload csv file
string empt = empty;
CsvReader csv = new CsvReader(csvData, true, ";", "'", "\"", empt, true, false);
number fieldCount = csv.FieldCount;
array addToSurvey;
array headers = csv.Headers;
while(csv.ReadNextRecord()) {
Dictionary csvinfo = Workflow_call(info_wfrid, {fieldCount, headers, csv});
if (Workflow_call(validate_info_wfrid, {csvinfo,DCSRid})== true)
 {
	  addToSurvey.Add(csvinfo);
 }
}
//addJournal(1497860,54,"Comment","before optimize_wfRid " + convertToString(addToSurvey));
if (isEmpty(addToSurvey) == false) 
{
	//Remove the duplicate email
	addToSurvey = Workflow_call(optimize_wfRid,{addToSurvey});
	
	//create qas and import		
	addToSurvey  = Workflow_call(createQAS_wfRid,{PQRid,EmailgroupRid,addToSurvey});
	Workflow_call(import_wfRid,{addToSurvey,PQRid,importtype});
	//send bulkmail
	InvitationBmRid  = Workflow_call(Bulkmail_wfRid,{"CG0129inz - Færgen KundeForum - Email Import To Base Qnaire Invitation",PQRid,MailtemplateRid,EmailgroupRid});	

}		
addJournal(1497860,54,"Comment","Import for " + convertToString(currentvalue) + " is done. The bulkmailRid "+ convertToString(InvitationBmRid) + " was sent out.");

Step 3 : Execute the program to upload the file

Open the command line, then Execute "SendFileToCatglobe.exe". This program will need the params like below :

  • username : input the username for logging to the site where we input the workflow
  • password : input the password for logging to the site where we input the workflow
  • workflowrid : input the workflow resource id which we will execute when the file is uploaded
  • url : the site URL where we input the workflow
  • filename : the name of imported file. As usually, I always put the file in the same location with the program.

Here is example :

Execute the program.jpg