Skip navigation
All Places > CA Service Management > Blog > Authors Gutis

CA Service Management

4 Posts authored by: Gutis Champion
Gutis

SpelMaster Event

Posted by Gutis Champion Jun 8, 2016

Hello Community,

Recently I have discovered how to overcome one of the most frustrating limitations of CA SDM Spel Code. The “limitation” in mind was very annoying and interfered with some of my ideas on how to improve CA SDM. It took me about 10 years and countless hours to finally overcome it

Of course I would like to share this with You guys. But … this isn’t something that I would like to give up so easily . I had a chat with Chris and we agreed to organize a “friendly competition” in which you will have a chance to find by Yourself solution for this “limitation”. The first person that will get it working will receive special SpelMaster badge. If nobody will manage, this secret will remain unrevealed.

Rules for our “friendly competition”: * Please review a short video demo provided bellow and identify what Spel Code limitation had to be solved in order to develop such functionality. Your valid guesses can be posted as comments. The correct guess will be a trigger for the next stage of competition.

This first step is intended to see if CA Service management community is interested in my findings, so if no correct answer is given within 10 days, we’ll end this all together.

* After we get correct identification of the problem to solve, I will provide an assignment to solve and the first clue that will help You do that. If no solution is provided after 5 days, I will post another clue.

* All in all, there will be 3 clues, that are scattered around the community, and You can search and use them anytime to find the solution for provided assignment, after all clues revealed you will have 10 days to earn the badge.

* You can do this individually or as a team (if so let us know who from community is the team).

 

So let’s start. Time is ticking

 

 

 

So the Spel Code limitation was correctly identified by JussiValkonen. In short the problem is how to execute external server side script and get response from it by the means of Spel Code (e.g. execute external program on the server and receive output from it).

 

Assignment is as follows:

 

  • Create a batch file on server with the following content:

 

         @echo off

          echo Output to the spel from batch file succeded!

 

  • Execute a batch file by using your custom Spel Code script and log response in stdlog file from the same Spel Code script.

 

 

 

 

To get you started here is the process on how the solution can be implemented:

 

 

 

You have 5 days before first clue will be revealed.

 

 

First step is to call Perl script from Spel code. So the first clue is hidden in this post:

https://communities.ca.com/message/241850944

Perl script can be executed as usual Spel code, but it should be
done in one particular way, and the clue how to do this is located in this post

https://communities.ca.com/thread/241738128

 

Hopefully you found a way to
execute Perl script and the batch file within that script. The tricky part is
to return output from the batch file to the Spel code. The clue how to do this
is also located in

https://communities.ca.com/thread/241738128

The main trick is that
set_return_data method in Perl is a little bit different than in Spel code. How
different – this You should try and find by yourself.

 

These are all the clues and You have 10 days left to provide us with solution and receive SpelMaster badge.

I was looking for the method to get information about all current sessions in SDM. As I understand bop-login is the process responsible for handling of the sessions. From trigger definition in ldap.maj i have learned that it is possible to execute methods defined there. Examination of boplgn.exe revealed that there is a number of other methods defined there, and one of them is called session_info that returns a lot of interesting information like:

count of active sessions, session id's, userid, current user role and etc.

 

Here is an example of the code that you can use to execute using bop_cmd

 

void login2()
{
int i,j,count;
send_wait(0, (object)("@|BOP-LOGIN|validate_user|0"), "session_info");
   if (msg_error()) { 
    printf("Error %s",msg[0]);
   }
   else{
    j=0;
    count = msg[0];

    printf("Sessions found: %s \n",count);
    for(i=0;i<count;i++){
    j=i*12+1;

    printf("======= %s ==============\n", msg[j+3]);
    printf("Session ID: %s \n", msg[j]);
    printf("Webengine: %s \n", msg[j+1]);
    printf("Domsrv: %s \n", msg[j+2]);
    printf("Userid: %s \n", msg[j+3]);
    printf("User persistent_id: %s \n", msg[j+4]);
    printf("Current user role: %s \n", msg[j+5]);
    printf("Licensed? %s \n", msg[j+6]);
    printf("Session type: %s \n", msg[j+7]);
    //All session types canS be found in session_type object here are some of them
    //"Web browser session" ,"1"
    //"SOAP Web services session" ,"3"
    //"Server utility session" ,"4"
    //"REST Web Services Session" ,"10"
    printf("Web Service login policy: %s \n", msg[j+8]);
    printf("Session status: %s \n", msg[j+9]);//4 - incative 2 - active 3-timed-out
    printf("Login time stamp: %s \n", msg[j+10]);
    printf("Logout time stamp: %s \n", msg[j+11]);
    printf("\n\n\n");
    }

   }
}

And here is batch file content to execute it

bop_cmd -u ServiceDesk -f %~dp0/log.frg login2("")

 

 

 

I also have plans to explore bop_login methods further. If someone have any info on this topic please share.

Gutis

ObjectX Basics

Posted by Gutis Champion Sep 15, 2015

 

I have decided to do some research and create object by the means of functionality as close to incident as possible

WARNING: if you allergic to spel code, triggers or schema modifications don’t waste your time by reading this post.

   

Step 1 Table.

 

I have created the following table:

 

////////////////////////////////////////////////////////////////////////

// Factory:   zobjectx (objectx)

////////////////////////////////////////////////////////////////////////

 

OBJECT zobjectx {

  DISPLAY_NAME "objectx";

  ATTRIBUTES zobjectx {

    customer SREL cnt;

    delete_flag SREL actbool

      REQUIRED

      {

      ON_NEW DEFAULT 0;

      };

    description STRING 4000;

    open_date DATE

      WRITE_NEW REQUIRED

      {

      ON_NEW DEFAULT NOW;

      };

    requester SREL cnt

      REQUIRED

      {

      ON_NEW DEFAULT USER;

      };

    last_mod_dt DATE { ON_CI SET NOW; };

    last_mod_by SREL cnt { ON_CI SET USER;

                           ON_NEW DEFAULT USER; };

  };

  FACTORY zobjectx {          

    STANDARD_LISTS {

      MLIST OFF;

      RLIST OFF;

    };

    REL_ATTR id;

    COMMON_NAME description;

  };

};

 

 

Step 2. Security

 

Since I want to manage security by standard means I need to enable data partitions and functional access functionality for my object

 

  1. Functional Access -  I have created the following functional access record

        

Defined this functional access for my table:

 

   

  1. Data Partitions – Since it is not possible to do this from interface, we need to load it by using pdm_load

     

    pdm_load –m –i –f dp.load

     

    content of dp.load:

     

    TABLE Controlled_Table

                  del desc obj_name sym

                  { "0" ,"Object X" ,"zobjectx" ,"Object X" }

     

    After that it is necessary to recycle service of CA SDM

     

    Ok now it is possible to define data partitions for my objectx

    

Step 3 Forms:

I have created files detai_zobjectx.htmpl and list_zobjectx.htmpl from the template files in bopcfg (detai.template; list.template). Files attached.

 

Step 4 Scoreboards:

Now I have object and forms, next I would like possibility to define scoreboards for my custom object, and have default filter for inactive objects.

 

Since I need to do some modifications that cannot be controlled by pdm_wsp, I created objectx.mod file where I place schema modifications that are needed for scoreboards

 

Content of object.mod

 

////////////////////////////////////////////////////////////////////////

// Factory:   zobjectx (objectx)

// Description: Fac_Attr_Entry zobjectx

////////////////////////////////////////////////////////////////////////

OBJECT zobjectx {

  FACTORY zobjectx {

    DISPLAY_GROUP "stored_query";

  //domset used for user scoreboard counts

    DOMSET scoreboard_user_bin "id" "" DYNAMIC ;

STANDARD_LISTS {

  WHERE "delete_flag = 0" ;

  MLIST OFF;

  RLIST OFF;

};

 

  };

};

Now I can define stored query and scoreboard for the type ObjectX

 

Conclusion:

 

  1. I have created custom object
  2. I can fully control security for this object
  3. I can write stored queries and scoreboard
  4. I have main forms for my object

  

 

 

Next I will look for the way to create activity log for my object, enable notifications for it and etc. If anyone have experience with that please share your knowledge.

 

Add trigger via web screen painter:

 

POST_VALIDATE zattach_callback_event(call_back_date) 117 FILTER(call_back_date{} && active == 1 && type == 'R');

 

 

Create multiple notification macro and notification event.

 

copy attached zattach_callback_event.spl file In \site\mods\majic folder. Do not forget to change an event ID 'evt:400034' to your ID in the script:

 

Use on your own risk

Enjoy