Showing posts with label javascripting. Show all posts
Showing posts with label javascripting. Show all posts

Wednesday, June 06, 2012

Watching $'s in JavaScript

Every time I write a script that uses repository constants, I always have trouble remembering how to pass their values properly.  Hopefully this posting will make me remember.

Both the "%" and "$" characters are used by JavaScript, so if the following code is encountered you will get an error:

var LDAP_SEARCHURL = "ldap://" + %$rep.LDAP_HOST% + ":" + %$rep.LDAP_PORT% + "/" + %$rep.LDAP_STARTING_POINT% + LDAP_SEARCH;

The dollar sign is used for calling a type of function and I believe the percent symbol is used for a mathematical operation. The solution is simple, just place the constants in quotes:

var LDAP_SEARCHURL = "ldap://" + "%$rep.LDAP_HOST%" + ":" + "%$rep.LDAP_PORT%" + "/" + "%$rep.LDAP_STARTING_POINT%" + LDAP_SEARCH;

It seems that IDM is smart enough to evaluate the value in the quotes and realize that the value is a repository constant and evaluate the value properly.





Thursday, July 28, 2011

Fitting It Into the Schedule

This title applies to more than one aspect of my Identity Management life these days. I've been very busy which accounts for the lack of blog entries lately.  It's not that I don't have what to write about.  It's more about finding the time to do it.  

I was given an interesting challenge lately.  We have a number of tasks on the current project that only need to run once a month., which is not a frequency that is supported by the IDM scheduler. There's actually a few ways to handle this. Most of which revolve around finding the batch file that is created when job is first run and tying this into the scheduling utility of your choice.

However, I was really interested in finding a way that would work within the IDM framework. So I came up with this little script:

// Main function: scheduler

function scheduler(Par){
//Only run the task on a particular day of the month.
//Should only be called from the Initialization script of a maintenance job.
//Created by: Matt Pollicove 7/7/11
//NW IDM Functions used in this script:
//uStop();
//uGetPassSubject();
//uWarning();
//*****
//NOTE: Requires an external Job Constant called Runday that is set to the
//two digit day of the month that the task should be executed on or this value
//must be hard coded

//Parameters for the task.  Name of the pass/task and what the legal execution day is
var strJobName = uGetPassSubject();
var strRunOnThisDay = '%$runday%';

//What's today's date and what is the actual date.
var strDate = '%$ddm.date%';
var strToday = strDate.substring(3,5);

//Put it all together
if (strToday != strRunOnThisDay){
     uWarning(strJobName + " is not scheduleItd to run on " + strDate);
     uStop();
}         
}

As you can see, it's not terribly complicated, but let's break it down:

The task first grabs the name of the running task for informational purposes.  Then it goes out to find a local constant (feel free to make an adjustment so that it works with a repository or global constant) which holds the day of the month the task should run on.

Once we have this, we do basically the same day with the current date, by getting it from the system parameter %$ddm.date%, and retrieving the date part of the current month.

Then we can compare the two values. If they're equal go ahead, if not, we log a message (another thing that can be taken out if desired) and call uStop().

  1. Now to use this functionality we need to do the following:
  2. Copy/Paste the script listing above into a NW IDM script.
  3. Create the RUNDAY constant.  Remember if you choose to create this as anything other than a job constant, you need to edit the script accordingly.
  4. This script could be used in either a managed task (yellow folder section) or a work flow task (although I'm not sure why). But the script should be placed in the "Initialization script" entry on the source tab of the first pass in the job. When running as a managed task, it should be scheduled to run once every 24 hours.

That's about it.  Hope this works for you.  Please remember to share any edits or improvements.

Wednesday, October 20, 2010

SAP TechEd on Wednesday, October 20th

As promised, I'm going to follow up on some of the challenges that Gregg Dippold had commented on. To the best of my knowledge, all of the information that I have reported here is public as of TechEd. I have chosen not to share some information as I felt that it was still to tentative to report. All of this information, of course, subject to change.

The short answer is: SAP NetWeaver Identity Management 7.2 is a huge leap forward.  It will be more customizable, have better tools for managing roles and connect to more systems than ever before. So here's Gregg's list of challenges and what I've learned so far.

Challenge 1: Self Service is Not Intuitive for Unsophisticated Users

Version 7.2 will be adding additional functionality to create custom user interfaces using an Open API. It might not make it into the initial release, but look for it in one of the 7.2 Service packs.

Challenge 2: Fragmented Documentation
 
Don't know about this one, but I can say that the documentation has been getting steadily better, so I'm cautiously optimistic.

Challenge 3: Limitations in the Staging Environment

I think we're all aware of some of the limitations in the Import/Export.  Look for some changes that will make transferring configurations between environments much easier. Among these will be an interface from the Web UI to export the entire configuration including repositories to a single XML file. Also to be included in 7.2 is a configuration analyzer which will review the entire configuration and check for objects 7.1 that will not work in 7.2 and do some basic checking for inefficient practices (such as queries that use aValue rather than SearchValue.

Note: I forgot to add that this utility will also export associated VDS configurations as well.

Challenge 4: Job Customization Frequently Requires Custom JavaScript

I don't know that this can ever really go away, as there needs to be some mechanism for implementing transformations of attributes and back end processing.  To make things more interesting, we'll also see more use of the extension framework which will be JAVA based and open up some new and exciting possibilities.  We can also expect to see some changes to the standard provisioning framework that will make connectivity to SAP and non-SAP systems a bit easier.

Challenge 5: Few Useful Reports Available in Default Installation


This could also be a big item as 7.2 will now talk to the Business Warehouse. From what I saw during the presentation these reports will be much better than the previous Jasper and Crystal based reports.

That's about it for the moment.  Heading to a session on VDS shortly.  Hopefully, I'll get some more information that I'm free to share.

Wednesday, September 01, 2010

Scripting Tips

A quick entry, but a couple of tips when creating SAP IDM scripts:

1. Do not put a space between a built in function and its argument.
2. Do not put a space between Par.get and the argument in a "To Generic" pass.
3. Be careful of infinite loops

Violating any one of these rules can start a java.exe process that will take 99% of CPU.

More about how I discovered all of this soon.