update tbl_IMPORT_ObjectiveTargets set fse_salesRepId = NULL, fse_targetVerified = NULL, fse_objectiveVerified = NULL where ownerId = and ownertype = and eai_batchid = update staging set staging.fse_salesRepId = fsp.fspro_userid from tbl_IMPORT_ObjectiveTargets staging inner join tbl_fspro_members fsp on fsp.ownerid = and fsp.fsl_tablecode = and fsp.email = staging.rep_email and fsp.staffmember = 1 where staging.ownerId = and staging.ownertype = and staging.eai_batchid = update staging set staging.fse_targetVerified = 'Y' from tbl_IMPORT_ObjectiveTargets staging inner join tbl_opr_clientoperators opr on opr.operatorid = staging.target_id and staging.target_type = 'operator' and opr.ownerid = and opr.fsltablecode = where staging.ownerId = and staging.ownertype = and staging.eai_batchid = update staging set staging.fse_targetVerified = 'Y' from tbl_IMPORT_ObjectiveTargets staging inner join tbl_cdr_distributors cdr on cdr.cdr_recordid = staging.target_id and staging.target_type = 'distributor' and cdr.ownerid = and cdr.fsl_tablecode = where staging.ownerId = and staging.ownertype = and staging.eai_batchid = update staging set staging.fse_objectiveVerified = 'N1' from tbl_IMPORT_ObjectiveTargets staging inner join tbl_bcrm_objectives obj on obj.objectiveid = staging.objective_id and obj.ownerid = and obj.ownertype = and obj.objlevel = 'p' where staging.ownerId = and staging.ownertype = and staging.eai_batchid = and staging.fse_objectiveVerified is null update staging set staging.fse_objectiveVerified = 'N2' from tbl_IMPORT_ObjectiveTargets staging inner join tbl_bcrm_objectives obj on obj.objectiveid = staging.objective_id and obj.ownerid = and obj.ownertype = where staging.ownerId = and staging.ownertype = and staging.eai_batchid = and staging.fse_objectiveVerified is null and ( (staging.target_type = 'distributor' and obj.TargetType <> 'dst') or (staging.target_type = 'operator' and obj.TargetType <> 'opr') ) update staging set staging.fse_objectiveVerified = 'Y' from tbl_IMPORT_ObjectiveTargets staging inner join tbl_bcrm_objectives obj on obj.objectiveid = staging.objective_id and obj.ownerid = and obj.ownertype = where staging.ownerId = and staging.ownertype = and staging.eai_batchid = and staging.fse_objectiveVerified is null select fse_salesrepid, target_type, target_id, objective_id from tbl_IMPORT_ObjectiveTargets where ownerId = and ownertype = and eai_batchid = and fse_salesRepId is not null and fse_targetVerified = 'y' and fse_objectiveVerified = 'y' select fspro_userid from tbl_bcrm_objectivestflink where ownerid = and ownertype = and objectiveid = and fspro_userid = insert into tbl_bcrm_objectivestflink (ownerid, ownertype, objectiveid, fspro_userid, inserttype, quota) values ( , , , , , 0 ) select distinct fse_salesRepId, objective_id from tbl_IMPORT_ObjectiveTargets staging inner join tbl_bcrm_objectives obj on obj.objectiveid = staging.objective_id and ( obj.quotatype = 'APL' or obj.quotatype = 'APR' ) where staging.ownerId = and staging.ownertype = and staging.eai_batchid = and staging.fse_salesRepId is not null and staging.fse_targetVerified = 'y' and staging.fse_objectiveVerified = 'y' update tbl_bcrm_objectivestflink set quota = ( select count(*) from tbl_bcrm_objectivetrglink where objectiveid = and OrigRepAssignment = and InsertType = 'M' ) where objectiveid = and fspro_userid = update tbl_bcrm_objectives set TotalQuota = ( select count(*) from tbl_bcrm_objectivetrglink where objectiveid = and InsertType = 'M' ) where objectiveid = select distinct objective_id from tbl_IMPORT_ObjectiveTargets staging where staging.ownerId = and staging.ownertype = and staging.eai_batchid = and staging.fse_salesRepId is not null and staging.fse_targetVerified = 'y' and staging.fse_objectiveVerified = 'y' update tbl_bcrm_objectives set recalcExecuted = 1 where ownerid = and ownertype = and objectiveid = select count(*) as lineCount from tbl_IMPORT_ObjectiveTargets staging where staging.ownerId = and staging.ownertype = and staging.eai_batchid = and staging.fse_salesRepId is not null and staging.fse_targetVerified = 'y' and staging.fse_objectiveVerified = 'y' select count(*) as lineCount from tbl_IMPORT_ObjectiveTargets staging where staging.ownerId = and staging.ownertype = and staging.eai_batchid =

#numberformat(qryLinesImported.lineCount,"9,999")# out of #numberformat(qryTotalLines.lineCount,"9,999")# total lines successfully imported!

select distinct rep_email from tbl_IMPORT_ObjectiveTargets staging where staging.ownerId = and staging.ownertype = and staging.eai_batchid = and staging.fse_salesrepid is null order by rep_email
Invalid Rep Email
Email Address
#htmleditformat( rep_email )#
select distinct target_id, target_type, target_name from tbl_IMPORT_ObjectiveTargets staging where staging.ownerId = and staging.ownertype = and staging.eai_batchid = and staging.fse_targetverified is null order by target_id, target_type, target_name
Invalid Accounts
Target ID Target Type Target Name
#htmleditformat( target_id )# #htmleditformat( target_type )# #htmleditformat( target_name )#
select distinct objective_id, objective_name from tbl_IMPORT_ObjectiveTargets staging where staging.ownerId = and staging.ownertype = and staging.eai_batchid = and staging.fse_objectiveverified = 'N1' order by objective_id, objective_name
Invalid Objectives - Objective is a Parent/Enterprise Level
Obj ID Description
#htmleditformat( objective_id )# #htmleditformat( objective_name )#
select distinct objective_id, objective_name, target_id, target_type, target_name from tbl_IMPORT_ObjectiveTargets staging where staging.ownerId = and staging.ownertype = and staging.eai_batchid = and staging.fse_objectiveverified = 'N2' order by objective_id, objective_name, target_id, target_type, target_name
Invalid Objective Targets - Target Doesn't Match Objective Target Type
Obj ID Description Target
#htmleditformat( objective_id )# #htmleditformat( objective_name )# #target_type# - #target_id# - #target_name#
select distinct objective_id, objective_name from tbl_IMPORT_ObjectiveTargets staging where staging.ownerId = and staging.ownertype = and staging.eai_batchid = and staging.fse_objectiveverified is null order by objective_id, objective_name
Invalid Objective ID
Obj ID Description
#htmleditformat( objective_id )# #htmleditformat( objective_name )#