CG0129inz - FÆRGEN A/S Kundepanel - Import email info to base questionnaire
Revision as of 09:14, 6 February 2012 by Cg huyphong (talk | contribs)
Contents
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
Step 2 :Prepare the workflow script for solving the uploaded data
array a = Workflow_getParameters();
string csvData = a[0];
number DCSRid = 1497859; // DCS : used for filtering the email. The real value should be : 1497858
number EmailgroupRid = 1497862; // EmailgroupRid : used for contatining the import Email.
number PQRid = 1497857; // PQRid: used for the imported PQ. The real value should be : 1289245
number bulkmailId = 1548; // bulkmailId : used for sending the invitation. The real value should be : 1549
DCS_use(DCSRid);
DCS_rebuild();
//Sub workflows for data resolve
number info_wfrid = 1293521; //CG0129inz - FÆRGEN A/S Kundepanel - get info from the record on csv file
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 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
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);
}
}
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});
//send bulkmail
string guid = getResourceGuid(Resource_Type_BulkMail , bulkmailId);
number bulkmailRid = getResourceUniqueIdFromGuid(guid);
BulkMail_send(bulkmailRid);
}
addJournal(1497860,54,"Comment","Import for " + convertToString(currentvalue) + " is done");
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 :