TCC

TCC – Referencing a User-defined Field Explicitly in an Import File

I ran across this and thought that it was odd. On a candidate import, instead of using the standard field Prefix, we were needing to target a user defined selection elements named Prefix. The error being returned was the following:

Error Detail:
Code: internal
Description: A general internal error occurred.
Reason: Relation “Prefix” not found for the entity “Candidate” in the product pack
The error occurred in the following step: Prepare Import
The corresponding code for this error in version 1.0 would have been: -1

It was odd because one is a field and the other a selection. The fix can be found in Doc ID 1047706.1 on the MOS.
Basically to explicitly declare a user defined field/selection, you need to prefix CustomField: to the field name in order to specify you’re speaking of a custom field. So Prefix,Description becomes CustomField:Prefix,Description and the error is solved.


PowerShell

Powershell – Archive Log Files by Day

Log files, you have to love them because they allow you to figure out what’s going on but what do you do with them, by default they just keep writing and writing and at some point you need to do something with them.
I found this powershell script that can do exactly that and put it here for safe keeping

##############
# This script requires WMF version >= 5.0 -  Download WMF 5.1 from https://www.microsoft.com/en-us/download/details.aspx?id=54616
# The directory that has the files desired to be imported MUST HAVE TRAILING "\"
$path = "C:\onedrive_tt\Client\AbbVie\TCC_Touchpoints\doc\20190910-ResponseFiles\results\"
# Optional filter to only touch files with specified extension 
$mask = "*.csv" 
$ZipFileName= "CompressedBackup.zip"
#Filter to only touch files older than specified hours
$hours = 24
# Begin SMTP Server information 
# $SMTPPassword = "PlainText SMTP Password"
# $SMTPUser = "SMTP Authentication user, will also be SMTP From: address"
# $SMTPServer = "my.smtpserver.com"
# $SMTPTo = 'receive@myemail.com'
# $SMTPSubjectFail = "ZIP Folder script failed to run"
# $secpasswd = ConvertTo-SecureString $SMTPPassword -AsPlainText -Force
# $mycreds = New-Object System.Management.Automation.PSCredential($SMTPUser, $secpasswd)
# End SMTP Configuration
$problem = $false
$date = (Get-Date).tostring("yyyyMMdd")
#Pre setting error message to no issue, will change later in the script
$errorMessage="no issue"


#############


try {
    # Get all items from specified path, recursing into directories but not returning directories themselves. Excluding files with modificiation dates less than $hours
    $files = Get-ChildItem $path -Recurse -Include $mask | where {($_.LastWriteTime -lt (Get-Date).AddHours(-$hours)) -and ($_.psIsContainer -eq $false)} 
    foreach ($file in $files) {
        $Directory = $path + $file.LastWriteTime.Date.ToString('yyyyMMdd')
        if (!(Test-Path $Directory)) {
	        New-Item $directory -type directory
	    }
	    Move-Item $file.fullname $Directory
    }
    $folders = Get-ChildItem $path -Directory  | % { $_.FullName }
    foreach ($folder in $folders) {
        $zipname = $folder + $ZipFileName
        if (!(test-path $zipname)){
        compress-archive -LiteralPath $folder -DestinationPath $zipname
        }
        if (test-path $zipname){
        remove-item -Recurse $folder 
        }
        else {
        Write-host $zipname + "Did not create, so I'm not deleting" + $folder
        }
    }
}
catch {
    $problem = $true
    $errormessage = $_.Exception.Message
}
finally {
    if ($problem){
        Write-Host $errorMessage
        # Send-MailMessage  -SmtpServer  $SMTPServer -UseSsl -From $SMTPUser -To $SMTPTo -Subject $SMTPSubjectFail  -Body $ErrorMessage -Credential $mycreds  
    }
    else {
        Write-Host "Script ran sucessfully"
    }
}
TCC

TCC – File Attachment Location by Candidate Visiblity

File attachments are (of course) part and parcel of integration tasks. On of the things that needs to be understood is the difference between candidate visible attachments, and candidate non-visible attachments.
This comes into play in two scenerios. Exporting candidate attachments and exporting application attachments as each case has candidate visible/non-visible attachments.

So to document where each is here is the breakdown:
CANDIDATE
If you’re only looking to pull candidate visible attachments, these are located here: Candidate,AttachedFiles,FileContent
To pull both candidate visible/non-visible attachments, those are located here: Candidate,TalentUser,Profile,AttachedFiles,FileContent
APPLICATION
If you’re only looking to pull candidate visible attachments, these are located here: Application,AttachedFiles,FileContent
To pull both candidate visible/non-visible attachments, those are located here: Application,ProfileInformation,AttachedFiles,FileContent

TCC

TCC – Application Motive

So one of the more painful points of pulling application data is to get at the motive. It’s hard because the motive is literally buried in the history of the application profile. Here’s a complex projection that can help with the excruciating process.

<quer:projection alias="CSWMotive" xmlns:quer="http://www.taleo.com/ws/integration/query">
  <quer:query projectedClass="Application" alias="sqMotives" preventDuplicates="true" pagingsize="1">
    <quer:projections>
      <quer:projection alias="Motive">
        <quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingCSWItem.CSWMotives,Mnemonic"/>
      </quer:projection>
    </quer:projections>
    <quer:filterings>
      <quer:filtering>
        <quer:equal>
          <quer:field path="Number"/>
          <quer:field ownerQuery="MainQuery" path="Number"/>
        </quer:equal>
      </quer:filtering>
      <quer:filtering>
        <quer:equal>
          <quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingCSWItem.Step,Mnemonic"/>
          <quer:field ownerQuery="MainQuery" path="CSWLatestStep,Mnemonic"/>
        </quer:equal>
      </quer:filtering>
      <quer:filtering>
        <quer:equal>
          <quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingCSWItem.Status,Mnemonic"/>
          <quer:field ownerQuery="MainQuery" path="CSWLatestStatus,Mnemonic"/>
        </quer:equal>
      </quer:filtering>
      <quer:filtering>
        <quer:equal>
          <quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingCSWItem.Reverted"/>
          <quer:boolean>false</quer:boolean>
        </quer:equal>
      </quer:filtering>
      <quer:filtering>
        <quer:equal>
          <quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingHistoryItem.CreationDate"/>
          <quer:query projectedClass="Application" alias="sqMaxDate" preventDuplicates="true" pagingsize="1">
            <quer:projections>
              <quer:projection alias="Motive">
                <quer:maximum>
                  <quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingHistoryItem.CreationDate"/>
                </quer:maximum>
              </quer:projection>
            </quer:projections>
            <quer:filterings>
              <quer:filtering>
                <quer:equal>
                  <quer:field path="Number"/>
                  <quer:field ownerQuery="MainQuery" path="Number"/>
                </quer:equal>
              </quer:filtering>
              <quer:filtering>
                <quer:equal>
                  <quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingCSWItem.Step,Mnemonic"/>
                  <quer:field ownerQuery="MainQuery" path="CSWLatestStep,Mnemonic"/>
                </quer:equal>
              </quer:filtering>
              <quer:filtering>
                <quer:equal>
                  <quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingCSWItem.Status,Mnemonic"/>
                  <quer:field ownerQuery="MainQuery" path="CSWLatestStatus,Mnemonic"/>
                </quer:equal>
              </quer:filtering>
              <quer:filtering>
                <quer:equal>
                  <quer:field path="ProfileInformation,HistoryItems,ApplicationTrackingCSWItem.Reverted"/>
                  <quer:boolean>false</quer:boolean>
                </quer:equal>
              </quer:filtering>
            </quer:filterings>
          </quer:query>
        </quer:equal>
      </quer:filtering>
    </quer:filterings>
  </quer:query>
</quer:projection>
TCC

TCC – TALEO_HOST vs TALEO_ZONE

As you know a lot of times it’s extremely helpful to have the zone designation on a export file title so you know exactly what zone it came out of. I find this really helpful in cases where you’re pulling UDSElements.
Here’s how these two variables work:
TALEO_HOST – Gives the full URL of the zone (e.g. ptrthinktalent.taleo.net)
TALEO_ZONE – Gives only the zone portion of the URL (e.g. ptrthinktalent) so the taleo.net is assumed.

TCC

TCC – Min Mid & Max Salaries

The minimum, mid-point and maximum salaries are fairly important things that come up when importing requisitions or on new hire exports. So this should be a simple process to identify right? I mean there should be a MinimumSalary, MidPointSalary and a MaximumSalary, it’s a no brainer or so one would think.

Unfortunately a naming convention like this would make things too easy and that’s just not allowed. So for posterity I’ve listed these to keep me from banging my head against the wall next time I need them (from the requisition entity):

MinimumSalary – JobInformation,OfferParameter,PayValue
MidPointSalary – JobInformation,MidPointSalary
MaximumSalary – JobInformation,OfferParameter,MaximumSalary

TCC

TCC – EEO Question Update

So there are times when you’re loading candidates and you want to bring in the EEO that’s been answered in another system. The MOS has an article on how to answer one question, but what if you want to answer more than one?

Create a file called CandidateDiversityAnswerUpdate_ld.xml

Add the following XML to the file:

<?xml version="1.0" encoding="UTF-8"?>
<load:load productCode="RC1502" model="http://www.taleo.com/ws/tee800/2009/01" root="Candidate" operation="merge" locale="en" header="true" delimiter="," quote="&quot;" xmlns:load="http://www.taleo.com/ws/integration/load">
    <load:columns>
        <load:column parameter="1" type="DATA" path="EmailAddress" searchType="SEARCH_AND_VALUE" searchTarget="." localeType="NONE"/>
        <load:column parameter="1" type="DATA" path="FirstName" localeType="NONE"/>
        <load:column parameter="1" type="DATA" path="LastName" localeType="NONE"/>
        <load:column parameter="1" type="DATA" path="DiversityAnswers,PossibleAnswer,Question,Code" searchType="SEARCH" searchTarget=".." entityMarker="true" entityTarget="../.." localeType="NONE"/>
        <load:column parameter="1" type="DATA" path="DiversityAnswers,PossibleAnswer,Sequence" searchType="SEARCH" searchTarget="." localeType="NONE"/>
        <load:column parameter="1" type="DATA" path="DiversityAnswers,PossibleAnswer,Question,Code" searchType="SEARCH" searchTarget=".." entityMarker="true" entityTarget="../.." localeType="NONE"/>
        <load:column parameter="1" type="DATA" path="DiversityAnswers,PossibleAnswer,Sequence" searchType="SEARCH" searchTarget="." localeType="NONE"/>
    </load:columns>
    <load:processingInstructions/>
</load:load>
TCC

TCC – File extension from file name

For some reason this has come up and I’d been attending to it in XSL but I really needed it strait out of TCC. Here is the projection that will give that to you.

<quer:projection alias="FileExtension" xmlns:quer="http://www.taleo.com/ws/integration/query">
<quer:substring>
<quer:field path="FileName"/>
<quer:customFunction name="instr">
<quer:field path="FileName"/>
<quer:string>.</quer:string>
<quer:integer>-1</quer:integer>
</quer:customFunction>
<quer:integer>99</quer:integer>
</quer:substring>
</quer:projection>
TCC

TCC – Requisition Approved Date

Ran across a need to pull the approved date (latest) from a requisition export and it seems like something I could run across again so here it is:

<quer:projection alias="Recruiting_Start_Date" xmlns:quer="http://www.taleo.com/ws/integration/query">
<quer:query projectedclass="Requisition" alias="sqLocation" preventduplicates="true" pagingsize="1">
<quer:projections>
<quer:projection alias="ApproveDate" projectedvaluetype="string">
<quer:customfunction name="TO_CHAR">
<quer:field path="RequisitionEvent,EventDate">
<quer:string>yyyy-MM-dd</quer:string>
</quer:field></quer:customfunction>
</quer:projection>
</quer:projections>
<quer:filterings>
<quer:filtering>
<quer:equal>
<quer:field path="Number">
<quer:field ownerquery="MainQuery" path="Number">
</quer:field></quer:field></quer:equal>
</quer:filtering>
<quer:filtering>
<quer:equal>
<quer:field path="RequisitionEvent,WorkActionNumber">
<quer:string>12</quer:string>
</quer:field></quer:equal>
</quer:filtering>
<quer:filtering>
<quer:equal>
<quer:field path="RequisitionEvent,EventDate">
<quer:query projectedclass="Requisition" alias="sqMotives" preventduplicates="true" pagingsize="1">
<quer:subqueries>
<quer:projections>
<quer:projection>
<quer:maximum>
<quer:field path="RequisitionEvent,EventDate">
</quer:field></quer:maximum>
</quer:projection>
</quer:projections>
<quer:filterings>
<quer:filtering>
<quer:equal>
<quer:field path="Number">
<quer:field ownerquery="MainQuery" path="Number">
</quer:field></quer:field></quer:equal>
</quer:filtering>
<quer:filtering>
<quer:equal>
<quer:field path="RequisitionEvent,WorkActionNumber">
<quer:string>12</quer:string>
</quer:field></quer:equal>
</quer:filtering>
</quer:filterings>
</quer:subqueries></quer:query>
</quer:field></quer:equal>
</quer:filtering>
</quer:filterings>
</quer:query>
</quer:projection>
TCC

TCC – Current DateTime (NOW)

On occasion you need to export the current date/time for one reason or another. This is how you get it out of the export:

<quer:projection alias="CurrentDateTime" xmlns:quer="http://www.taleo.com/ws/integration/query">
	<quer:customFunction name="TO_CHAR">
		<quer:date type="now"/>
		<quer:string>yyyy-MM-dd</quer:string>
	</quer:customFunction>
</quer:projection>
[