0
Answered

Schedule "Generate Changes" for an Adapter in Identity Broker

Alan Schmarr 7 years ago updated 7 years ago 7

Hi,

I'm looking for scheduling "Generate Changes" for an Adapter that is using PowerShell transformation.

I had a look at using Scheduled Jobs PowerShell activity, the documentation online don't really show examples or if it is possible.

Please can you direct me with some examples?


Answer

Answer
Answered

Hi Alan,

As you suggested, this should be possible with a Scheduled Job similar to the following

$adapterId = [Guid]'00000000-0000-0000-0000-000000000000'
$components.AdapterEngine.SimulateChanges($adapterId)

I'm curious what your specific use case is, because I think ultimately there's a better solution to this problem. Do you know at the time that the transformation runs when future changes will be required for each entity?

GOOD, I'M SATISFIED
Satisfaction mark by Alan Schmarr 7 years ago
Answer
Answered

Hi Alan,

As you suggested, this should be possible with a Scheduled Job similar to the following

$adapterId = [Guid]'00000000-0000-0000-0000-000000000000'
$components.AdapterEngine.SimulateChanges($adapterId)

I'm curious what your specific use case is, because I think ultimately there's a better solution to this problem. Do you know at the time that the transformation runs when future changes will be required for each entity?

The issue is that the record never changes they have a furure start date and i cacl if the record is active using the start date. it is an csv connector.  

This sounds exactly like the use case for the Time Offset Flag transformation. If you set the Offset Field to the field containing your start date, the Destination Field to your new field (e.g. HasStarted), the Time Offset to 0 (or perhaps a few hours to get it to 9am or a desired specific start time), and the four flags as appropriate (e.g. Equal and Greater as True, Lesser and Null as False), you should get the desired behaviour.

Hi,

Back from leave and can share more about the solution. we are using more than one attribute to cacl the status of the record and powershell seemed to be the only option. see script below:

# Loop through each input entity
# Using TerminationDate & CompletionDate to generate isActive false or true
$datenow =  (get-date).Date
foreach ($entity in $entities)
{
    if($entity['TerminationDate']){
    
        #$date = (get-date $entity['TerminationDate']).Date
        $date = $entity['TerminationDate']
        if($datenow -eq $date){
            $entity['isActive'] = 'false'
        }
        elseif($datenow -gt $date){
            $entity['isActive'] = 'false'
        }
        else{
            $entity['isActive'] = 'true'
        }
        
    }
    elseif($entity['CompletionDate']){
        #$date = (get-date $entity['CompletionDate']).Date
        $date = $entity['CompletionDate']
        if($datenow -eq $date){
            $entity['isActive'] = 'false'
        }
        elseif($datenow -gt $date){
            $entity['isActive'] = 'false'
        }
        else{
            $entity['isActive'] = 'true'
        }
    }
    else{
        if($entity['ProposedStartingDate']){
            $date = $entity['ProposedStartingDate']
            if($datenow -eq $date){
                $entity['isActive'] = 'true'
            }
            elseif($datenow -gt $date){
                $entity['isActive'] = 'true'
            }
            else{
                $entity['isActive'] = 'false'
            }   
        }
        else{
            $entity['isActive'] = 'false'
        }
    }
    
}
+1

Hi Alan,

An alternative implementation might be to use Time Offset Flag transformations to generate IsTerminated, IsCompleted and HasStarted flags, and then use the PowerShell transformation only to perform the necessary boolean logic. In this case, change detection would occur automatically as part of the Time Offset Flag transformations.

Ok that makes sense

Don't know if there is an better transformation but for now i will implement the scheduled job to run once a day.


Is there more detail in how to use the powershell vars and methods!?